Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed single albums sometimes not being recognized as albums #486

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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":
Copy link
Owner

@sigma67 sigma67 Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @polvallverdu , thanks for your contribution. However, this will not work without localization. Note that "category" is not used anywhere else for code flow for this reason. Only result_type is localization independent (after delocalization in l.59)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I'll try to investigate it later today.

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
Loading