aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/channel.py
diff options
context:
space:
mode:
authorJames Taylor <28744867+user234683@users.noreply.github.com>2020-10-09 12:56:07 -0700
committerGitHub <noreply@github.com>2020-10-09 12:56:07 -0700
commita10a97a4593d8d65fae752439c3db44210d752e7 (patch)
treea8560e56ca2ee0ed41416fe175f8b3dac6612d91 /youtube/channel.py
parent9123d9a6cfa2af511b17591541ab2e67aa83475f (diff)
parenta0c33c621e49a255cd90d5062c8a3efaef77f703 (diff)
downloadyt-local-a10a97a4593d8d65fae752439c3db44210d752e7.tar.lz
yt-local-a10a97a4593d8d65fae752439c3db44210d752e7.tar.xz
yt-local-a10a97a4593d8d65fae752439c3db44210d752e7.zip
Merge pull request #26 from zrose584/num_videos_fix
fix get_number_of_videos_channel
Diffstat (limited to 'youtube/channel.py')
-rw-r--r--youtube/channel.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index ad6db5b..e9cc87b 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -150,7 +150,8 @@ def get_number_of_videos_channel(channel_id):
response = response.decode('utf-8')
- match = re.search(r'"numVideosText":\s*{\s*"runs":\s*\[{"text":\s*"([\d,]*) videos"', response)
+ # match = re.search(r'"numVideosText":\s*{\s*"runs":\s*\[{"text":\s*"([\d,]*) videos"', response)
+ match = re.search(r'"numVideosText".*?([,\d]+)', response)
if match:
return int(match.group(1).replace(',',''))
else:
@@ -209,7 +210,7 @@ def get_channel_page_general_url(base_url, tab, request, channel_id=None):
if tab == 'videos' and channel_id:
tasks = (
- gevent.spawn(get_number_of_videos_channel, channel_id),
+ gevent.spawn(get_number_of_videos_channel, channel_id),
gevent.spawn(get_channel_tab, channel_id, page_number, sort, 'videos', view)
)
gevent.joinall(tasks)
@@ -217,7 +218,7 @@ def get_channel_page_general_url(base_url, tab, request, channel_id=None):
number_of_videos, polymer_json = tasks[0].value, tasks[1].value
elif tab == 'videos':
tasks = (
- gevent.spawn(get_number_of_videos_general, base_url),
+ gevent.spawn(get_number_of_videos_general, base_url),
gevent.spawn(util.fetch_url, base_url + '/videos?pbj=1&view=0', headers_desktop, debug_name='gen_channel_videos')
)
gevent.joinall(tasks)