get_charts: fix views, add video artists
This commit is contained in:
parent
3aaeaa28f7
commit
0aa284e860
3 changed files with 15 additions and 10 deletions
|
|
@ -179,14 +179,15 @@ def parse_single(result):
|
||||||
|
|
||||||
|
|
||||||
def parse_video(result):
|
def parse_video(result):
|
||||||
|
runs = result['subtitle']['runs']
|
||||||
video = {
|
video = {
|
||||||
'title': nav(result, TITLE_TEXT),
|
'title': nav(result, TITLE_TEXT),
|
||||||
'videoId': nav(result, NAVIGATION_VIDEO_ID),
|
'videoId': nav(result, NAVIGATION_VIDEO_ID),
|
||||||
|
'artists': parse_song_artists_runs(runs[:-2]),
|
||||||
'playlistId': nav(result, NAVIGATION_PLAYLIST_ID, True),
|
'playlistId': nav(result, NAVIGATION_PLAYLIST_ID, True),
|
||||||
'thumbnails': nav(result, THUMBNAIL_RENDERER, True)
|
'thumbnails': nav(result, THUMBNAIL_RENDERER, True)
|
||||||
}
|
}
|
||||||
if len(result['subtitle']['runs']) == 3:
|
video['views'] = runs[-1]['text'].split(' ')[0]
|
||||||
video['views'] = nav(result, SUBTITLE2).split(' ')[0]
|
|
||||||
return video
|
return video
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ def parse_chart_song(data):
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
flex_1 = get_flex_column_item(data, 1)
|
flex_1 = get_flex_column_item(data, 1)
|
||||||
parsed['views'] = nav(flex_1, ['text', 'runs', 2, 'text']).split(' ')[0]
|
parsed['views'] = nav(flex_1, ['text', 'runs', -1, 'text']).split(' ')[0]
|
||||||
parsed.update(parse_ranking(data))
|
parsed.update(parse_ranking(data))
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ def parse_song_artists(data, index):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
runs = flex_item['text']['runs']
|
runs = flex_item['text']['runs']
|
||||||
|
return parse_song_artists_runs(runs)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_song_artists_runs(runs):
|
||||||
artists = []
|
artists = []
|
||||||
for j in range(int(len(runs) / 2) + 1):
|
for j in range(int(len(runs) / 2) + 1):
|
||||||
artists.append({
|
artists.append({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue