From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 23 Feb 2025 00:33:49 +0000 (+0100)
Subject: Add fix for broken YouTube API.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/conditions?a=commitdiff_plain;h=d6e00d33c34daf49881eca5933ea38e2d28f7efa;p=ytplom

Add fix for broken YouTube API.
---

diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py
index ae6b441..0a94f96 100644
--- a/src/ytplom/misc.py
+++ b/src/ytplom/misc.py
@@ -226,6 +226,8 @@ class YoutubeQuery(DbData):
         results: list[YoutubeVideo] = []
         ids_to_detail: list[YoutubeId] = []
         for item in search_request.execute()['items']:
+            if 'videoId' not in item['id']:  # for whatever reason, the API
+                continue                     # may return channels (no videoId)
             video_id: YoutubeId = item['id']['videoId']
             ids_to_detail += [video_id]
             snippet = item['snippet']