innertube artist overview
This commit is contained in:
parent
7b0f9ea857
commit
44fee8939b
@ -29,7 +29,6 @@ def music_card_shelf_renderer(renderer: dict) -> List[DatabaseObject]:
|
|||||||
def music_responsive_list_item_flex_column_renderer(renderer: dict) -> List[DatabaseObject]:
|
def music_responsive_list_item_flex_column_renderer(renderer: dict) -> List[DatabaseObject]:
|
||||||
return parse_run_list(renderer.get("text", {}).get("runs", []))
|
return parse_run_list(renderer.get("text", {}).get("runs", []))
|
||||||
|
|
||||||
|
|
||||||
def music_responsive_list_item_renderer(renderer: dict) -> List[DatabaseObject]:
|
def music_responsive_list_item_renderer(renderer: dict) -> List[DatabaseObject]:
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ def music_responsive_list_item_renderer(renderer: dict) -> List[DatabaseObject]:
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
def music_shelf_renderer(renderer: dict) -> List[DatabaseObject]:
|
def music_shelf_renderer(renderer: dict) -> List[DatabaseObject]:
|
||||||
result = []
|
result = []
|
||||||
for subrenderer in renderer.get("contents"):
|
for subrenderer in renderer.get("contents"):
|
||||||
@ -76,12 +74,20 @@ def music_shelf_renderer(renderer: dict) -> List[DatabaseObject]:
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def music_carousel_shelf_renderer(renderer: dict):
|
||||||
|
return music_shelf_renderer(renderer=renderer)
|
||||||
|
|
||||||
|
def music_two_row_item_renderer(renderer: dict):
|
||||||
|
return parse_run_list(renderer.get("title", {}).get("runs", []))
|
||||||
|
|
||||||
|
|
||||||
RENDERER_PARSERS = {
|
RENDERER_PARSERS = {
|
||||||
"musicCardShelfRenderer": music_card_shelf_renderer,
|
"musicCardShelfRenderer": music_card_shelf_renderer,
|
||||||
"musicResponsiveListItemRenderer": music_responsive_list_item_renderer,
|
"musicResponsiveListItemRenderer": music_responsive_list_item_renderer,
|
||||||
"musicResponsiveListItemFlexColumnRenderer": music_responsive_list_item_flex_column_renderer,
|
"musicResponsiveListItemFlexColumnRenderer": music_responsive_list_item_flex_column_renderer,
|
||||||
"musicShelfRenderer": music_card_shelf_renderer,
|
"musicShelfRenderer": music_card_shelf_renderer,
|
||||||
|
"musicCarouselShelfRenderer": music_carousel_shelf_renderer,
|
||||||
|
"musicTwoRowItemRenderer": music_two_row_item_renderer,
|
||||||
|
|
||||||
"itemSectionRenderer": lambda _: [],
|
"itemSectionRenderer": lambda _: [],
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class YoutubeMusicConnection(Connection):
|
|||||||
value=cookie_value,
|
value=cookie_value,
|
||||||
path='/', domain='.youtube.com'
|
path='/', domain='.youtube.com'
|
||||||
)
|
)
|
||||||
# self.start_heartbeat()
|
|
||||||
|
|
||||||
def heartbeat(self):
|
def heartbeat(self):
|
||||||
r = self.get("https://music.youtube.com/verify_session", is_heartbeat=True)
|
r = self.get("https://music.youtube.com/verify_session", is_heartbeat=True)
|
||||||
@ -291,6 +291,18 @@ class YoutubeMusic(SuperYouTube):
|
|||||||
for i, content in enumerate(renderer_list):
|
for i, content in enumerate(renderer_list):
|
||||||
dump_to_file(f"{i}-artists-renderer.json", json.dumps(content), is_json=True, exit_after_dump=False)
|
dump_to_file(f"{i}-artists-renderer.json", json.dumps(content), is_json=True, exit_after_dump=False)
|
||||||
|
|
||||||
|
results = []
|
||||||
|
|
||||||
|
"""
|
||||||
|
cant use fixed indices, because if something has no entries, the list dissappears
|
||||||
|
instead I have to try parse everything, and just reject community playlists and profiles.
|
||||||
|
"""
|
||||||
|
|
||||||
|
for renderer in renderer_list:
|
||||||
|
results.extend(parse_renderer(renderer))
|
||||||
|
|
||||||
|
print(results)
|
||||||
|
|
||||||
return Artist()
|
return Artist()
|
||||||
|
|
||||||
def fetch_song(self, source: Source, stop_at_level: int = 1) -> Song:
|
def fetch_song(self, source: Source, stop_at_level: int = 1) -> Song:
|
||||||
|
Loading…
Reference in New Issue
Block a user