From 008dc79ebc32cd5b82a5cf048e67fe74757fb19e Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 11 May 2025 12:13:52 +0700 Subject: [PATCH] add channel_name fallback for failed extraction --- backend/channel/src/index.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/channel/src/index.py b/backend/channel/src/index.py index 64c9a88d..929aa5c9 100644 --- a/backend/channel/src/index.py +++ b/backend/channel/src/index.py @@ -56,12 +56,13 @@ class YoutubeChannel(YouTubeItem): def process_youtube_meta(self): """extract relevant fields""" self.youtube_meta["thumbnails"].reverse() + channel_name = self.youtube_meta["uploader"] or self.youtube_meta["id"] self.json_data = { "channel_active": True, "channel_description": self.youtube_meta.get("description", ""), "channel_id": self.youtube_id, "channel_last_refresh": int(datetime.now().timestamp()), - "channel_name": self.youtube_meta["uploader"], + "channel_name": channel_name, "channel_subs": self.youtube_meta.get("channel_follower_count", 0), "channel_subscribed": False, "channel_tags": self.youtube_meta.get("tags", []),