fixed KeyError in get_charts
This commit is contained in:
parent
56d54a2b50
commit
f1141d3f5a
2 changed files with 6 additions and 1 deletions
|
|
@ -26,6 +26,8 @@ PAGE_TYPE = [
|
|||
]
|
||||
WATCH_VIDEO_ID = ['watchEndpoint', 'videoId']
|
||||
NAVIGATION_VIDEO_ID = ['navigationEndpoint'] + WATCH_VIDEO_ID
|
||||
QUEUE_VIDEO_ID = ['queueAddEndpoint','queueTarget','videoId']
|
||||
NAVIGATION_VIDEO_ID_2 = MENU_ITEMS+[0]+MENU_SERVICE+QUEUE_VIDEO_ID
|
||||
NAVIGATION_PLAYLIST_ID = ['navigationEndpoint', 'watchEndpoint', 'playlistId']
|
||||
NAVIGATION_WATCH_PLAYLIST_ID = ['navigationEndpoint', 'watchPlaylistEndpoint', 'playlistId']
|
||||
NAVIGATION_VIDEO_TYPE = [
|
||||
|
|
|
|||
|
|
@ -103,9 +103,12 @@ def parse_song_flat(data):
|
|||
def parse_video(result):
|
||||
runs = nav(result, SUBTITLE_RUNS)
|
||||
artists_len = get_dot_separator_index(runs)
|
||||
videoId = nav(result, NAVIGATION_VIDEO_ID, True)
|
||||
if not videoId:
|
||||
videoId = nav(result, NAVIGATION_VIDEO_ID_2)
|
||||
return {
|
||||
'title': nav(result, TITLE_TEXT),
|
||||
'videoId': nav(result, NAVIGATION_VIDEO_ID),
|
||||
'videoId': videoId,
|
||||
'artists': parse_song_artists_runs(runs[:artists_len]),
|
||||
'playlistId': nav(result, NAVIGATION_PLAYLIST_ID, True),
|
||||
'thumbnails': nav(result, THUMBNAIL_RENDERER, True),
|
||||
|
|
|
|||
Loading…
Reference in a new issue