aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--youtube/channel.py31
-rw-r--r--youtube/templates/channel.html7
2 files changed, 19 insertions, 19 deletions
diff --git a/youtube/channel.py b/youtube/channel.py
index 2ba2440..efb336b 100644
--- a/youtube/channel.py
+++ b/youtube/channel.py
@@ -28,7 +28,8 @@ headers_pbj = (
('X-YouTube-Client-Name', '2'),
('X-YouTube-Client-Version', '2.20180830'),
)
-generic_cookie = (('Cookie', 'VISITOR_INFO1_LIVE=8XihrAcN1l4'),)
+real_cookie = (('Cookie', 'VISITOR_INFO1_LIVE=8XihrAcN1l4'),)
+generic_cookie = (('Cookie', 'VISITOR_INFO1_LIVE=ST1Ti53r4fU'),)
# SORT:
# videos:
@@ -89,17 +90,23 @@ def channel_ctoken_mobile(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, print_status=True):
- ctoken = channel_ctoken_mobile(channel_id, page, sort, tab, view)
- ctoken = ctoken.replace('=', '%3D')
- url = ('https://m.youtube.com/channel/' + channel_id + '/' + tab
- + '?ctoken=' + ctoken + '&pbj=1')
-
- if print_status:
- print("Sending channel tab ajax request")
- content = util.fetch_url(url,
- util.mobile_ua + headers_pbj + generic_cookie, debug_name='channel_tab')
- if print_status:
- print("Finished recieving channel tab response")
+ message = 'Got channel tab' if print_status else None
+
+ if int(sort) == 2 and int(page) > 1: # use mobile endpoint
+ ctoken = channel_ctoken_mobile(channel_id, page, sort, tab, view)
+ ctoken = ctoken.replace('=', '%3D')
+ url = ('https://m.youtube.com/channel/' + channel_id + '/' + tab
+ + '?ctoken=' + ctoken + '&pbj=1')
+ content = util.fetch_url(url,
+ util.mobile_ua + headers_pbj + real_cookie,
+ debug_name='channel_tab', report_text=message)
+ else: # use desktop endpoint
+ ctoken = channel_ctoken_desktop(channel_id, page, sort, tab, view)
+ ctoken = ctoken.replace('=', '%3D')
+ url = 'https://www.youtube.com/browse_ajax?ctoken=' + ctoken
+ content = util.fetch_url(url,
+ util.desktop_ua + headers_1 + generic_cookie,
+ debug_name='channel_tab', report_text=message)
return content
diff --git a/youtube/templates/channel.html b/youtube/templates/channel.html
index ef2bedf..a0cdff9 100644
--- a/youtube/templates/channel.html
+++ b/youtube/templates/channel.html
@@ -68,13 +68,6 @@
.item-grid{
padding-left: 20px;
}
- .item-grid .horizontal-item-box .item{
- width:330px;
- }
- .no-description .thumbnail-box{
- width: 120px;
- height:90px;
- }
.item-list{
width:800px;
margin: auto;