Add radio/Shuffle ID to search results
This commit is contained in:
parent
eee9d38f55
commit
623f846e29
1 changed files with 24 additions and 1 deletions
|
|
@ -71,7 +71,8 @@ class Parser:
|
||||||
search_result['feedbackTokens'] = parse_song_menu_tokens(toggle_menu)
|
search_result['feedbackTokens'] = parse_song_menu_tokens(toggle_menu)
|
||||||
|
|
||||||
elif resultType in ['video']:
|
elif resultType in ['video']:
|
||||||
search_result['views'] = get_item_text(data, 1, 2 + last_artist_index).split(' ')[0]
|
search_result['views'] = get_item_text(data, 1,
|
||||||
|
2 + last_artist_index).split(' ')[0]
|
||||||
search_result['duration'] = get_item_text(data, 1, 4 + last_artist_index, True)
|
search_result['duration'] = get_item_text(data, 1, 4 + last_artist_index, True)
|
||||||
|
|
||||||
elif resultType in ['upload']:
|
elif resultType in ['upload']:
|
||||||
|
|
@ -113,6 +114,28 @@ class Parser:
|
||||||
search_result['releaseDate'] = runs[2]
|
search_result['releaseDate'] = runs[2]
|
||||||
search_result['resultType'] = 'album'
|
search_result['resultType'] = 'album'
|
||||||
|
|
||||||
|
watch_menu = find_objects_by_key(nav(data, MENU_ITEMS), 'menuNavigationItemRenderer')
|
||||||
|
for item in [_x['menuNavigationItemRenderer'] for _x in watch_menu]:
|
||||||
|
icon = nav(item, ['icon', 'iconType'])
|
||||||
|
if icon == 'MUSIC_SHUFFLE':
|
||||||
|
watch_key = 'shuffleId'
|
||||||
|
elif icon == 'MIX':
|
||||||
|
watch_key = 'radioId'
|
||||||
|
else:
|
||||||
|
# ADD_TO_PLAYLIST
|
||||||
|
# ALBUM
|
||||||
|
# ARTIST
|
||||||
|
# SHARE
|
||||||
|
continue
|
||||||
|
|
||||||
|
watch_id = nav(item, ['navigationEndpoint', 'watchPlaylistEndpoint', 'playlistId'],
|
||||||
|
True)
|
||||||
|
if not watch_id:
|
||||||
|
watch_id = nav(item, ['navigationEndpoint', 'watchEndpoint', 'playlistId'],
|
||||||
|
True)
|
||||||
|
if watch_id:
|
||||||
|
search_result[watch_key] = watch_id
|
||||||
|
|
||||||
search_result['thumbnails'] = nav(data, THUMBNAILS)
|
search_result['thumbnails'] = nav(data, THUMBNAILS)
|
||||||
search_results.append(search_result)
|
search_results.append(search_result)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue