Skip to content

Commit

Permalink
Fixed single albums sometimes not being recognized as albums
Browse files Browse the repository at this point in the history
  • Loading branch information
polvallverdu committed Dec 15, 2023
1 parent 43d3c3b commit 7a9558c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ytmusicapi/parsers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7a9558c

Please sign in to comment.