return video type on get watch playlist

This commit is contained in:
Lucas Macedo 2022-03-24 12:20:55 -03:00 • committed by sigma67
commit 56b266dbdb
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0
3 changed files with 6 additions and 2 deletions

View file

@ -25,7 +25,7 @@ NAVIGATION_VIDEO_ID = ['navigationEndpoint', 'watchEndpoint', 'videoId']
NAVIGATION_PLAYLIST_ID = ['navigationEndpoint', 'watchEndpoint', 'playlistId']
NAVIGATION_WATCH_PLAYLIST_ID = ['navigationEndpoint', 'watchPlaylistEndpoint', 'playlistId']
NAVIGATION_VIDEO_TYPE = [
'playNavigationEndpoint', 'watchEndpoint', 'watchEndpointMusicSupportedConfigs', 'watchEndpointMusicConfig', 'musicVideoType'
'watchEndpoint', 'watchEndpointMusicSupportedConfigs', 'watchEndpointMusicConfig', 'musicVideoType'
]
HEADER_DETAIL = ['header', 'musicDetailHeaderRenderer']
DESCRIPTION = ['description'] + RUN_TEXT

View file

@ -144,6 +144,9 @@ class Parser:
search_result['videoId'] = nav(
data, PLAY_BUTTON + ['playNavigationEndpoint', 'watchEndpoint', 'videoId'],
True)
search_result['videoType'] = nav(
data, PLAY_BUTTON + ['playNavigationEndpoint'] + NAVIGATION_VIDEO_TYPE,
True)
if resultType in ['song', 'video', 'album']:
search_result['duration'] = None

View file

@ -43,7 +43,8 @@ def parse_watch_track(data):
'length': nav(data, ['lengthText', 'runs', 0, 'text'], True),
'thumbnail': nav(data, THUMBNAIL),
'feedbackTokens': feedback_tokens,
'likeStatus': like_status
'likeStatus': like_status,
'videoType': nav(data, ['navigationEndpoint'] + NAVIGATION_VIDEO_TYPE, True)
}
track.update(song_info)
return track