aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorzrose584 <57181548+zrose584@users.noreply.github.com>2020-10-09 19:41:31 +0200
committerzrose584 <57181548+zrose584@users.noreply.github.com>2020-10-09 19:43:22 +0200
commita0c33c621e49a255cd90d5062c8a3efaef77f703 (patch)
treea8560e56ca2ee0ed41416fe175f8b3dac6612d91 /youtube
parent9123d9a6cfa2af511b17591541ab2e67aa83475f (diff)
downloadyt-local-a0c33c621e49a255cd90d5062c8a3efaef77f703.tar.lz
yt-local-a0c33c621e49a255cd90d5062c8a3efaef77f703.tar.xz
yt-local-a0c33c621e49a255cd90d5062c8a3efaef77f703.zip
fix get_number_of_videos_channel
Diffstat (limited to 'youtube')
-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)