home · contact · privacy
Add fix for broken YouTube API. master
authorChristian Heller <c.heller@plomlompom.de>
Sun, 23 Feb 2025 00:33:49 +0000 (01:33 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 23 Feb 2025 00:33:49 +0000 (01:33 +0100)
src/ytplom/misc.py

index ae6b441fa2768f1d9b7df54d002e03f619f82665..0a94f96d654a0d195f70af52f619a599ea53b97a 100644 (file)
@@ -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']