aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-12-23 14:39:59 -0800
committerJames Taylor <user234683@users.noreply.github.com>2019-12-23 14:39:59 -0800
commit777ed756dcfd01845451937fb38559ee57ec44e9 (patch)
treedebc2f6db7a6d0b5021e2f3480a6067397a71581 /youtube/yt_data_extract
parentc56fc56fa66242ae75a5b8f3e9c697f0f23c253a (diff)
downloadyt-local-777ed756dcfd01845451937fb38559ee57ec44e9.tar.lz
yt-local-777ed756dcfd01845451937fb38559ee57ec44e9.tar.xz
yt-local-777ed756dcfd01845451937fb38559ee57ec44e9.zip
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.
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r--youtube/yt_data_extract/everything_else.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index 4e3271f..5194693 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -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: