From 7a9558c8278222f2021fd7a91ca899fed3f1e59d Mon Sep 17 00:00:00 2001 From: polvallverdu Date: Fri, 15 Dec 2023 15:54:49 +0100 Subject: [PATCH] Fixed single albums sometimes not being recognized as albums --- ytmusicapi/parsers/search.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ytmusicapi/parsers/search.py b/ytmusicapi/parsers/search.py index 96d724b0..f10789ab 100644 --- a/ytmusicapi/parsers/search.py +++ b/ytmusicapi/parsers/search.py @@ -50,8 +50,11 @@ def parse_search_result(data, search_result_types, result_type, category): default_offset = (not result_type or result_type == "album") * 2 search_result = {'category': category} video_type = nav(data, PLAY_BUTTON + ['playNavigationEndpoint'] + NAVIGATION_VIDEO_TYPE, True) - if not result_type and video_type: - result_type = 'song' if video_type == 'MUSIC_VIDEO_TYPE_ATV' else 'video' + if not result_type: + if search_result["category"] == "Albums": + result_type = 'album' + elif video_type: + result_type = 'song' if video_type == 'MUSIC_VIDEO_TYPE_ATV' else 'video' result_type = get_search_result_type(get_item_text(data, 1), search_result_types) if not result_type else result_type