validate playlist ids in playlist methods
additionally small code quality improvements
This commit is contained in:
parent
84af92a442
commit
5ae470e260
6 changed files with 29 additions and 26 deletions
|
|
@ -1,4 +1,5 @@
|
|||
# commonly used navigation paths
|
||||
RUN_TEXT = ['runs', 0, 'text']
|
||||
TAB_CONTENT = ['tabs', 0, 'tabRenderer', 'content']
|
||||
SINGLE_COLUMN_TAB = ['contents', 'singleColumnBrowseResultsRenderer'] + TAB_CONTENT
|
||||
SECTION_LIST = ['sectionListRenderer', 'contents']
|
||||
|
|
@ -20,12 +21,13 @@ NAVIGATION_VIDEO_ID = ['navigationEndpoint', 'watchEndpoint', 'videoId']
|
|||
NAVIGATION_PLAYLIST_ID = ['navigationEndpoint', 'watchEndpoint', 'playlistId']
|
||||
NAVIGATION_WATCH_PLAYLIST_ID = ['navigationEndpoint', 'watchPlaylistEndpoint', 'playlistId']
|
||||
HEADER_DETAIL = ['header', 'musicDetailHeaderRenderer']
|
||||
DESCRIPTION = ['description'] + RUN_TEXT
|
||||
CAROUSEL_TITLE = ['header', 'musicCarouselShelfBasicHeaderRenderer', 'title', 'runs', 0]
|
||||
FRAMEWORK_MUTATIONS = ['frameworkUpdates', 'entityBatchUpdate', 'mutations']
|
||||
TITLE = ['title', 'runs', 0]
|
||||
TITLE_TEXT = ['title', 'runs', 0, 'text']
|
||||
TITLE_TEXT = ['title'] + RUN_TEXT
|
||||
TEXT_RUN = ['text', 'runs', 0]
|
||||
SUBTITLE = ['subtitle', 'runs', 0, 'text']
|
||||
SUBTITLE = ['subtitle'] + RUN_TEXT
|
||||
SUBTITLE2 = ['subtitle', 'runs', 2, 'text']
|
||||
SUBTITLE3 = ['subtitle', 'runs', 4, 'text']
|
||||
THUMBNAIL = ['thumbnail', 'thumbnails']
|
||||
|
|
|
|||
|
|
@ -138,6 +138,10 @@ def validate_response(response, per_page, limit, current_count):
|
|||
return len(response['parsed']) >= expected_items_count
|
||||
|
||||
|
||||
def validate_playlist_id(playlistId):
|
||||
return playlistId if not playlistId.startswith("VL") else playlistId[2:]
|
||||
|
||||
|
||||
def nav(root, items, none_if_absent=False):
|
||||
"""Access a nested object in root by item sequence."""
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue