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):
|
||||
runs = result['subtitle']['runs']
|
||||
video = {
|
||||
'title': nav(result, TITLE_TEXT),
|
||||
'videoId': nav(result, NAVIGATION_VIDEO_ID),
|
||||
'artists': parse_song_artists_runs(runs[:-2]),
|
||||
'playlistId': nav(result, NAVIGATION_PLAYLIST_ID, True),
|
||||
'thumbnails': nav(result, THUMBNAIL_RENDERER, True)
|
||||
}
|
||||
if len(result['subtitle']['runs']) == 3:
|
||||
video['views'] = nav(result, SUBTITLE2).split(' ')[0]
|
||||
video['views'] = runs[-1]['text'].split(' ')[0]
|
||||
return video
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ def parse_chart_song(data):
|
|||
}
|
||||
else:
|
||||
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))
|
||||
return parsed
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,17 @@ def parse_song_artists(data, index):
|
|||
return None
|
||||
else:
|
||||
runs = flex_item['text']['runs']
|
||||
artists = []
|
||||
for j in range(int(len(runs) / 2) + 1):
|
||||
artists.append({
|
||||
'name': runs[j * 2]['text'],
|
||||
'id': nav(runs[j * 2], NAVIGATION_BROWSE_ID, True)
|
||||
})
|
||||
return artists
|
||||
return parse_song_artists_runs(runs)
|
||||
|
||||
|
||||
def parse_song_artists_runs(runs):
|
||||
artists = []
|
||||
for j in range(int(len(runs) / 2) + 1):
|
||||
artists.append({
|
||||
'name': runs[j * 2]['text'],
|
||||
'id': nav(runs[j * 2], NAVIGATION_BROWSE_ID, True)
|
||||
})
|
||||
return artists
|
||||
|
||||
|
||||
def parse_song_runs(runs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue