Improved podcast downloading

This commit is contained in:
Footsiefat 2021-10-21 13:12:07 +13:00
parent 5838ea0ce1
commit 6c260e25ff
1 changed files with 20 additions and 14 deletions

View File

@ -182,6 +182,9 @@ def getEpisodeInfo(episode_id_str):
info = json.loads(requests.get("https://api.spotify.com/v1/episodes/" +
episode_id_str, headers={"Authorization": "Bearer %s" % token}).text)
if "error" in info:
return None, None
else:
return info["show"]["name"], info["name"]
@ -189,6 +192,9 @@ def downloadEpisode(episode_id_str):
global ROOT_PODCAST_PATH
podcastName, episodeName = getEpisodeInfo(episode_id_str)
if podcastName == None:
print("### SKIPPING: (EPISODE NOT FOUND) ###")
else:
filename = podcastName + " - " + episodeName + ".wav"
episode_id = EpisodeId.from_base62(episode_id_str)