youtube: Don’t fail if default thumb size is missing
This commit is contained in:
parent
527077fab4
commit
efdbd0fdb2
|
@ -31,7 +31,11 @@ def construct_rss(client: APIClient, channel_id: str) -> str:
|
||||||
|
|
||||||
video_id = video["resourceId"]["videoId"]
|
video_id = video["resourceId"]["videoId"]
|
||||||
link = f"https://www.youtube.com/watch?v={video_id}"
|
link = f"https://www.youtube.com/watch?v={video_id}"
|
||||||
thumbnail = video["thumbnails"]["standard"]["url"]
|
thumbnail = ""
|
||||||
|
|
||||||
|
for size in ("standard", "maxres", *video["thumbnails"].keys()):
|
||||||
|
if size in video["thumbnails"]:
|
||||||
|
thumbnail = video["thumbnails"][size]["url"]
|
||||||
|
|
||||||
item["guid"] = video["resourceId"]["videoId"]
|
item["guid"] = video["resourceId"]["videoId"]
|
||||||
item["title"] = video.get("title", "Untitled Video")
|
item["title"] = video.get("title", "Untitled Video")
|
||||||
|
|
Loading…
Reference in New Issue