diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-01-05 00:20:39 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-01-05 00:20:39 -0800 |
commit | a57fc774260f2940449880ec9b6aaf40fa2776c3 (patch) | |
tree | 5a3c1620f637d0ed9c965dc3aadb16f397471e15 /youtube/playlist.py | |
parent | ec2fb71a3701379246e3b9210cce25aa3f548fcc (diff) | |
download | yt-local-a57fc774260f2940449880ec9b6aaf40fa2776c3.tar.lz yt-local-a57fc774260f2940449880ec9b6aaf40fa2776c3.tar.xz yt-local-a57fc774260f2940449880ec9b6aaf40fa2776c3.zip |
WSGI for simple non-path GET pages
Diffstat (limited to 'youtube/playlist.py')
-rw-r--r-- | youtube/playlist.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/youtube/playlist.py b/youtube/playlist.py index c16dc7f..9e3eb4b 100644 --- a/youtube/playlist.py +++ b/youtube/playlist.py @@ -78,8 +78,9 @@ def get_videos_ajax(playlist_id, page): playlist_stat_template = Template(''' <div>$stat</div>''') -def get_playlist_page(query_string): - parameters = urllib.parse.parse_qs(query_string) +def get_playlist_page(env, start_response): + start_response('200 OK', [('Content-type','text/html'),]) + parameters = env['fields'] playlist_id = parameters['list'][0] page = parameters.get("page", "1")[0] if page == "1": @@ -105,7 +106,7 @@ def get_playlist_page(query_string): metadata = common.ajax_info(first_page_json['content']['playlist_header']) video_count = int(metadata['size'].replace(',', '')) - page_buttons = common.page_buttons_html(int(page), math.ceil(video_count/20), common.URL_ORIGIN + "/playlist", query_string) + page_buttons = common.page_buttons_html(int(page), math.ceil(video_count/20), common.URL_ORIGIN + "/playlist", env['QUERY_STRING']) html_ready = common.get_html_ready(metadata) html_ready['page_title'] = html_ready['title'] + ' - Page ' + str(page) @@ -119,4 +120,4 @@ def get_playlist_page(query_string): page_buttons = page_buttons, stats = stats, **html_ready - )
\ No newline at end of file + ).encode('utf-8')
\ No newline at end of file |