Skip to content

Commit

Permalink
search: fix playlistId on album results
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed Jul 28, 2024
1 parent a15d90c commit 7d062c2
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions ytmusicapi/parsers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def parse_search_result(data, search_result_types, result_type, category):

elif result_type == "album":
search_result["type"] = get_item_text(data, 1)
search_result["playlistId"] = nav(data, [*PLAY_BUTTON, "playNavigationEndpoint", *WATCH_PID], True)

elif result_type == "playlist":
flex_item = get_flex_column_item(data, 1)["text"]["runs"]
Expand Down Expand Up @@ -163,13 +164,6 @@ def parse_search_result(data, search_result_types, result_type, category):
if result_type in ["song", "album"]:
search_result["isExplicit"] = nav(data, BADGE_LABEL, True) is not None

if result_type in ["album"]:
search_result["playlistId"] = nav(
data,
[*PLAY_BUTTON, "playNavigationEndpoint", "watchEndpoint", "playlistId"],
True,
)

if result_type in ["episode"]:
flex_item = get_flex_column_item(data, 1)
has_date = int(len(nav(flex_item, TEXT_RUNS)) > 1)
Expand Down

0 comments on commit 7d062c2

Please sign in to comment.