Channel: Change search results to use next and previous page buttons

Because youtube doesn't give the number of search results, so previous behavior would give an error if a page number out of range was selected.
This commit is contained in:
James Taylor
2019-12-23 14:39:59 -08:00
parent c56fc56fa6
commit 777ed756dc
5 changed files with 83 additions and 39 deletions

View File

@@ -59,9 +59,11 @@ def extract_channel_info(polymer_json, tab):
# get items
info['items'] = []
if tab in ('videos', 'playlists', 'search'):
items, _ = extract_items(response)
items, ctoken = extract_items(response)
additional_info = {'author': info['channel_name'], 'author_url': info['channel_url']}
info['items'] = [extract_item_info(renderer, additional_info) for renderer in items]
if tab == 'search':
info['is_last_page'] = (ctoken is None)
elif tab == 'about':
items, _ = extract_items(response, item_types={'channelAboutFullMetadataRenderer'})
if not items: