diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-12-20 01:25:36 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-12-20 01:25:36 -0800 |
commit | cbdc404703f5895d04e6d6af4241921b2a7bc39c (patch) | |
tree | fcd6d131d9b45b11582167b76fb44f41f07c8415 /youtube | |
parent | a8d74ba082404bac016b210d151fb2d46cbd54d9 (diff) | |
download | yt-local-cbdc404703f5895d04e6d6af4241921b2a7bc39c.tar.lz yt-local-cbdc404703f5895d04e6d6af4241921b2a7bc39c.tar.xz yt-local-cbdc404703f5895d04e6d6af4241921b2a7bc39c.zip |
Correctly handle case where video ID is too short
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/youtube.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube/youtube.py b/youtube/youtube.py index cb35eac..eb319e1 100644 --- a/youtube/youtube.py +++ b/youtube/youtube.py @@ -26,6 +26,10 @@ def youtube(env, start_response): return comments.get_comments_page(query_string).encode() elif path == "/watch": + video_id = urllib.parse.parse_qs(query_string)['v'][0] + if len(video_id) < 11: + start_response('404 Not Found', ()) + return b'Incomplete video id (too short): ' + video_id.encode('ascii') start_response('200 OK', (('Content-type','text/html'),) ) return watch.get_watch_page(query_string).encode() |