diff options
author | James Taylor <28744867+user234683@users.noreply.github.com> | 2020-10-12 09:37:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 09:37:54 -0700 |
commit | 641af53e2ea0cb7ea398631d13c804d7ac1e0a8a (patch) | |
tree | 7dfecaadce3cc58ddcc86e2cd9d5ef762563e9ce /youtube/playlist.py | |
parent | 2cfc6dec39ccdcc0c5fe2eea73f47b7040e51833 (diff) | |
parent | fd253d9e07fa34e2a22d28d445839147daca9ee0 (diff) | |
download | yt-local-641af53e2ea0cb7ea398631d13c804d7ac1e0a8a.tar.lz yt-local-641af53e2ea0cb7ea398631d13c804d7ac1e0a8a.tar.xz yt-local-641af53e2ea0cb7ea398631d13c804d7ac1e0a8a.zip |
Merge pull request #24 from zrose584/optional_proxy_images
settings.py: add 'proxy_images'
Diffstat (limited to 'youtube/playlist.py')
-rw-r--r-- | youtube/playlist.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/youtube/playlist.py b/youtube/playlist.py index 2e2af98..e596eae 100644 --- a/youtube/playlist.py +++ b/youtube/playlist.py @@ -1,5 +1,6 @@ from youtube import util, yt_data_extract, proto, local_playlist from youtube import yt_app +import settings import base64 import urllib @@ -14,15 +15,15 @@ import flask -def playlist_ctoken(playlist_id, offset): - +def playlist_ctoken(playlist_id, offset): + offset = proto.uint(1, offset) # this is just obfuscation as far as I can tell. It doesn't even follow protobuf offset = b'PT:' + proto.unpadded_b64encode(offset) offset = proto.string(15, offset) continuation_info = proto.string( 3, proto.percent_b64encode(offset) ) - + playlist_id = proto.string(2, 'VL' + playlist_id ) pointless_nest = proto.string(80226972, playlist_id + continuation_info) @@ -51,7 +52,7 @@ def playlist_first_page(playlist_id, report_text = "Retrieved playlist"): content = json.loads(util.uppercase_escape(content.decode('utf-8'))) return content - + #https://m.youtube.com/playlist?itct=CBMQybcCIhMIptj9xJaJ2wIV2JKcCh3Idwu-&ctoken=4qmFsgI2EiRWTFBMT3kwajlBdmxWWlB0bzZJa2pLZnB1MFNjeC0tN1BHVEMaDmVnWlFWRHBEUWxFJTNE&pbj=1 def get_videos(playlist_id, page): @@ -84,7 +85,7 @@ def get_playlist_page(): this_page_json = first_page_json else: tasks = ( - gevent.spawn(playlist_first_page, playlist_id, report_text="Retrieved playlist info" ), + gevent.spawn(playlist_first_page, playlist_id, report_text="Retrieved playlist info" ), gevent.spawn(get_videos, playlist_id, page) ) gevent.joinall(tasks) @@ -103,7 +104,7 @@ def get_playlist_page(): util.prefix_urls(item) util.add_extra_html_info(item) if 'id' in item: - item['thumbnail'] = '/https://i.ytimg.com/vi/' + item['id'] + '/default.jpg' + item['thumbnail'] = settings.img_prefix + 'https://i.ytimg.com/vi/' + item['id'] + '/default.jpg' item['url'] += '&list=' + playlist_id if item['index']: |