Add check if absent
Checking if nested objects absent solved solved my issue, #298 I'm not sure if it's suitable.
This commit is contained in:
parent
527fed67ff
commit
7de7ecfcc0
1 changed files with 6 additions and 5 deletions
|
|
@ -32,12 +32,13 @@ def parse_playlist_items(results, menu_entries: List[List] = None):
|
|||
feedback_tokens = parse_song_menu_tokens(item)
|
||||
|
||||
# if item is not playable, the videoId was retrieved above
|
||||
if 'playNavigationEndpoint' in nav(data, PLAY_BUTTON):
|
||||
videoId = nav(data,
|
||||
PLAY_BUTTON)['playNavigationEndpoint']['watchEndpoint']['videoId']
|
||||
if nav(data, PLAY_BUTTON, none_if_absent=True) != None:
|
||||
if 'playNavigationEndpoint' in nav(data, PLAY_BUTTON):
|
||||
videoId = nav(data,
|
||||
PLAY_BUTTON)['playNavigationEndpoint']['watchEndpoint']['videoId']
|
||||
|
||||
if 'menu' in data:
|
||||
like = nav(data, MENU_LIKE_STATUS, True)
|
||||
if 'menu' in data:
|
||||
like = nav(data, MENU_LIKE_STATUS, True)
|
||||
|
||||
title = get_item_text(data, 0)
|
||||
if title == 'Song deleted':
|
||||
|
|
|
|||
Loading…
Reference in a new issue