From d6e00d33c34daf49881eca5933ea38e2d28f7efa Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 23 Feb 2025 01:33:49 +0100
Subject: [PATCH] Add fix for broken YouTube API.

---
 src/ytplom/misc.py | 2 ++
 1 file changed, 2 insertions(+)

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']
-- 
2.30.2