aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract/everything_else.py
diff options
context:
space:
mode:
authorJesus E <heckyel@riseup.net>2023-05-28 21:04:36 -0400
committerJesus E <heckyel@riseup.net>2023-05-28 21:04:36 -0400
commit68752000f0213f801a7c5e8127b77afeba644f7d (patch)
treeb86637952fdd892bd41bc2f8de922116b6996c6d /youtube/yt_data_extract/everything_else.py
parent7b60751e997137f1ce53b94b1a89e9d3dc03c729 (diff)
downloadyt-local-68752000f0213f801a7c5e8127b77afeba644f7d.tar.lz
yt-local-68752000f0213f801a7c5e8127b77afeba644f7d.tar.xz
yt-local-68752000f0213f801a7c5e8127b77afeba644f7d.zip
Update channel to new ctoken format
Huge thanks to @michaelweiser Different sortings still don't work for videos and playlists
Diffstat (limited to 'youtube/yt_data_extract/everything_else.py')
-rw-r--r--youtube/yt_data_extract/everything_else.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index 56a2e68..9a6e31a 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -9,7 +9,7 @@ import re
import urllib
from math import ceil
-def extract_channel_info(polymer_json, tab):
+def extract_channel_info(polymer_json, tab, continuation=False):
response, err = extract_response(polymer_json)
if err:
return {'error': err}
@@ -23,7 +23,8 @@ def extract_channel_info(polymer_json, tab):
# channel doesn't exist or was terminated
# example terminated channel: https://www.youtube.com/channel/UCnKJeK_r90jDdIuzHXC0Org
- if not metadata:
+ # metadata and microformat are not present for continuation requests
+ if not metadata and not continuation:
if response.get('alerts'):
error_string = ' '.join(
extract_str(deep_get(alert, 'alertRenderer', 'text'), default='')
@@ -44,7 +45,7 @@ def extract_channel_info(polymer_json, tab):
info['approx_subscriber_count'] = extract_approx_int(deep_get(response,
'header', 'c4TabbedHeaderRenderer', 'subscriberCountText'))
- # stuff from microformat (info given by youtube for every page on channel)
+ # stuff from microformat (info given by youtube for first page on channel)
info['short_description'] = metadata.get('description')
if info['short_description'] and len(info['short_description']) > 730:
info['short_description'] = info['short_description'][0:730] + '...'
@@ -69,8 +70,8 @@ def extract_channel_info(polymer_json, tab):
info['ctoken'] = None
# empty channel
- if 'contents' not in response and 'continuationContents' not in response:
- return info
+ #if 'contents' not in response and 'continuationContents' not in response:
+ # return info
if tab in ('videos', 'playlists', 'search'):
items, ctoken = extract_items(response)