diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-11-05 01:27:01 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-11-05 01:27:01 -0800 |
commit | 8784070e75685086b2c1db2973e2082743da6296 (patch) | |
tree | 0ebd444140e1bd2103238fe7e463b1abf8949d54 /youtube/youtube.py | |
parent | 2f76eafbd6a7bbecc10c028ef2d47b24129b24d4 (diff) | |
download | yt-local-8784070e75685086b2c1db2973e2082743da6296.tar.lz yt-local-8784070e75685086b2c1db2973e2082743da6296.tar.xz yt-local-8784070e75685086b2c1db2973e2082743da6296.zip |
Server-side handling of local playlist thumbnails (forgot to include in last commit)
Diffstat (limited to 'youtube/youtube.py')
-rw-r--r-- | youtube/youtube.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube/youtube.py b/youtube/youtube.py index 925bcab..1a97b6c 100644 --- a/youtube/youtube.py +++ b/youtube/youtube.py @@ -48,6 +48,11 @@ def youtube(env, start_response): start_response('200 OK', (('Content-type','text/html'),) ) return local_playlist.get_playlist_page(path[10:], query_string=query_string).encode() + elif path.startswith("/data/playlist_thumbnails/"): + with open(path[1:], 'rb') as f: + start_response('200 OK', (('Content-type', "image/jpeg"),) ) + return f.read() + elif path.startswith("/api/"): start_response('200 OK', () ) result = common.fetch_url('https://www.youtube.com' + path + ('?' + query_string if query_string else '')) |