Skip to content

Commit

Permalink
Remove offset + fix top result
Browse files Browse the repository at this point in the history
Remove offset + fix top result
  • Loading branch information
AustinGitHub committed Jan 13, 2024
1 parent 16c9cbe commit 55db498
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ytmusicapi/parsers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ def parse_top_result(data, search_result_types):
search_result["videoType"] = nav(on_tap, NAVIGATION_VIDEO_TYPE)

if result_type in ["song", "video", "album"]:
on_tap = data.get("onTap")
if on_tap:
search_result["videoId"] = nav(on_tap, WATCH_VIDEO_ID)
search_result["videoType"] = nav(on_tap, NAVIGATION_VIDEO_TYPE)

search_result["title"] = nav(data, TITLE_TEXT)
runs = nav(data, ["subtitle", "runs"])[2:]
runs = nav(data, ["subtitle", "runs"])
song_info = parse_song_runs(runs)
search_result.update(song_info)

Expand Down Expand Up @@ -125,7 +130,7 @@ def parse_search_result(data, search_result_types, result_type, category):
search_result["duration"] = None
search_result["year"] = None
flex_item = get_flex_column_item(data, 1)
runs = flex_item["text"]["runs"][default_offset:]
runs = flex_item["text"]["runs"]
song_info = parse_song_runs(runs)
search_result.update(song_info)

Expand Down

0 comments on commit 55db498

Please sign in to comment.