I’ve trying to create a script to automatically download youtube channel’s audio and turn it into an audio podcast. I’m almost there.
I’m using the /wp-json/podlove/v2/episodes API call to create the episode entry then /wp-json/podlove/v2/episodes/{id} API call to load in the episode details – the data is getting loaded in ok, however:
- Is there a way to upload/create an episode in one call rather than two?
- The post title for each API created entry is: API created Podcast-Post – how can this be changed to reflect the title of the episode?
- The media needs to be manually verified, is there a way of automatically verifying the media on Episode creation? The /wp-json/podlove/v2/episodes/{id}/media call doesn’t work
- The episode/post is loaded in as draft, is there a way to publish the episode (assuming the media verification works)
Thanks
Example of Python script used:
cur.execute("Select * from audio where LocalRSS is Null order by EpisodeNo;")
rows = cur.fetchall()
for row in rows:
url = "http://172.17.0.6/wp-json/podlove/v2/episodes"
payload = {}
headers = {
'Authorization': 'Basic Ymx1ZWZyb2d1azprTGRnIGQ3MFggOUpEaiBPWDNCIFpMdnogZDR2NA=='
}
response = requests.request("post", url, headers=headers, data=payload)
podresponse = response.json()
print(podresponse)
podresponseID = str(podresponse['id'])
PodID = row[0]
PodTitle = str(row[1])
#payload['summary'] = str(row[2])
PodRecordingDate = str(row[3])
PodSlug = str(row[4])
PodEpNo = row[5]
PodDuration = str(row[6])
url = "http://172.17.0.6/wp-json/podlove/v2/episodes/"+podresponseID+"?title="+str(row[1])+"&slug="+str(row[4])+"&type=\"Full\"&number="+str(row[5])
payload = {}
headers = {
'Authorization': 'Basic Ymx1ZWZyb2d1azprTGRnIGQ3MFggOUpEaiBPWDNCIFpMdnogZDR2NA=='
}
response = requests.request("POST", url, headers=headers, json=payload)