aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/channel.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-09-06 15:45:01 -0700
committerJames Taylor <user234683@users.noreply.github.com>2019-09-06 15:45:01 -0700
commitac32b24b2a011292b704a3f27e8fd08a7ae9424b (patch)
tree0d6e021519dee62089733e20880c65cdb85d8841 /youtube/channel.py
parent7a93acabb3f5a8dd95ec0d56ae57cc34eb57c1b8 (diff)
parentc393031ac54af959561214c8b1d6b22647a81b89 (diff)
downloadyt-local-ac32b24b2a011292b704a3f27e8fd08a7ae9424b.tar.lz
yt-local-ac32b24b2a011292b704a3f27e8fd08a7ae9424b.tar.xz
yt-local-ac32b24b2a011292b704a3f27e8fd08a7ae9424b.zip
Merge subscriptions into master
Diffstat (limited to 'youtube/channel.py')
-rw-r--r--youtube/channel.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index 4c7d380..de75eaa 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -1,5 +1,5 @@
import base64
-from youtube import util, yt_data_extract, local_playlist
+from youtube import util, yt_data_extract, local_playlist, subscriptions
from youtube import yt_app
import urllib
@@ -83,13 +83,15 @@ def channel_ctoken(channel_id, page, sort, tab, view=1):
return base64.urlsafe_b64encode(pointless_nest).decode('ascii')
-def get_channel_tab(channel_id, page="1", sort=3, tab='videos', view=1):
+def get_channel_tab(channel_id, page="1", sort=3, tab='videos', view=1, print_status=True):
ctoken = channel_ctoken(channel_id, page, sort, tab, view).replace('=', '%3D')
url = "https://www.youtube.com/browse_ajax?ctoken=" + ctoken
- print("Sending channel tab ajax request")
+ if print_status:
+ print("Sending channel tab ajax request")
content = util.fetch_url(url, util.desktop_ua + headers_1, debug_name='channel_tab')
- print("Finished recieving channel tab response")
+ if print_status:
+ print("Finished recieving channel tab response")
return content
@@ -312,7 +314,7 @@ def get_channel_page(channel_id, tab='videos'):
info['current_sort'] = sort
elif tab == 'search':
info['search_box_value'] = query
-
+ info['subscribed'] = subscriptions.is_subscribed(info['channel_id'])
return flask.render_template('channel.html',
parameters_dictionary = request.args,
@@ -352,7 +354,7 @@ def get_channel_page_general_url(base_url, tab, request):
info['current_sort'] = sort
elif tab == 'search':
info['search_box_value'] = query
-
+ info['subscribed'] = subscriptions.is_subscribed(info['channel_id'])
return flask.render_template('channel.html',
parameters_dictionary = request.args,