Add support for /embed urls

This commit is contained in:
James Taylor 2019-12-20 19:23:15 -08:00
parent 310585ae9e
commit 80de90b1bb

View File

@ -272,8 +272,9 @@ def format_bytes(bytes):
@yt_app.route('/watch') @yt_app.route('/watch')
def get_watch_page(): @yt_app.route('/embed/<video_id>')
video_id = request.args['v'] def get_watch_page(video_id=None):
video_id = request.args.get('v') or video_id
if len(video_id) < 11: if len(video_id) < 11:
flask.abort(404) flask.abort(404)
flask.abort(flask.Response('Incomplete video id (too short): ' + video_id)) flask.abort(flask.Response('Incomplete video id (too short): ' + video_id))