From 55b362e4dc6722800b54c5adaa5ad69019e72897 Mon Sep 17 00:00:00 2001 From: Stefano Borsatto <57630292+borsattoz@users.noreply.github.com> Date: Mon, 24 Mar 2025 18:52:37 +0100 Subject: [PATCH] fix #751: `parse_video` returns always a video ID or `None` (#752) --- ytmusicapi/parsers/browsing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ytmusicapi/parsers/browsing.py b/ytmusicapi/parsers/browsing.py index 945c0ca..16568c6 100644 --- a/ytmusicapi/parsers/browsing.py +++ b/ytmusicapi/parsers/browsing.py @@ -117,7 +117,9 @@ def parse_video(result): videoId = nav(result, NAVIGATION_VIDEO_ID, True) if not videoId: videoId = next( - id for entry in nav(result, MENU_ITEMS) if nav(entry, MENU_SERVICE + QUEUE_VIDEO_ID, True) + video_id + for entry in nav(result, MENU_ITEMS) + if (video_id := nav(entry, MENU_SERVICE + QUEUE_VIDEO_ID, True)) ) return { "title": nav(result, TITLE_TEXT),