From 5142185355b3db430d27d52fd66b0915ade7a55f Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 29 May 2021 15:52:45 +0200 Subject: [PATCH] high(er) quality 'video unavailable' error page --- app/youtube/__init__.py | 3 ++- app/youtube/templates/video-error.html.j2 | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 app/youtube/templates/video-error.html.j2 diff --git a/app/youtube/__init__.py b/app/youtube/__init__.py index 2fff34e..46b1475 100644 --- a/app/youtube/__init__.py +++ b/app/youtube/__init__.py @@ -148,7 +148,8 @@ def watch(): return redirect(stream) else: if error and not metadata: # e.g. malformed, private/deleted video, ... - return errdetails + f"
Try visiting Invidious.",400 # TODO: nicer + return render_template('video-error.html.j2', video_id=video_id, + video_error=error, errdetails=errdetails, invidious_url=invidious_url) meta = prepare_metadata(metadata) with sqlite3.connect(cf['global']['database']) as conn: c = conn.cursor() diff --git a/app/youtube/templates/video-error.html.j2 b/app/youtube/templates/video-error.html.j2 new file mode 100644 index 0000000..76580b2 --- /dev/null +++ b/app/youtube/templates/video-error.html.j2 @@ -0,0 +1,14 @@ +{% extends "base.html.j2" %} +{% import 'macros.imp.j2' as macros %} + +{% block title %}Video Error{% endblock %} + +{% block content %} +
+ +
+ +
+ {{ errdetails }} Watch on Invidious or Youtube +
+{% endblock %} -- 2.39.3