feat: improved the youtube music album fetching
This commit is contained in:
parent
7e5a1f84ae
commit
be7e91cb7b
@ -430,6 +430,18 @@ class YoutubeMusic(SuperYouTube):
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
dump_to_file(f"{browse_id}.json", r.text, is_json=True, exit_after_dump=False)
|
dump_to_file(f"{browse_id}.json", r.text, is_json=True, exit_after_dump=False)
|
||||||
|
|
||||||
|
# artist details
|
||||||
|
header = data.get("header", {})
|
||||||
|
musicDetailHeaderRenderer = header.get("musicDetailHeaderRenderer", {})
|
||||||
|
|
||||||
|
title_runs: List[dict] = musicDetailHeaderRenderer.get("title", {}).get("runs", [])
|
||||||
|
subtitle_runs: List[dict] = musicDetailHeaderRenderer.get("subtitle", {}).get("runs", [])
|
||||||
|
|
||||||
|
if len(title_runs) > 0:
|
||||||
|
artist.name = title_runs[0].get("text", artist.name)
|
||||||
|
|
||||||
|
|
||||||
|
# fetch discography
|
||||||
renderer_list = r.json().get("contents", {}).get("singleColumnBrowseResultsRenderer", {}).get("tabs", [{}])[
|
renderer_list = r.json().get("contents", {}).get("singleColumnBrowseResultsRenderer", {}).get("tabs", [{}])[
|
||||||
0].get("tabRenderer", {}).get("content", {}).get("sectionListRenderer", {}).get("contents", [])
|
0].get("tabRenderer", {}).get("content", {}).get("sectionListRenderer", {}).get("contents", [])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user