From 220e04283a0d4fe1fa0822a6879344425f4f90ca Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 30 Jan 2022 11:46:40 +0000 Subject: [PATCH] Shortened youtube url --- webapp_media.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/webapp_media.py b/webapp_media.py index 03cb19faa..6cb1dde8b 100644 --- a/webapp_media.py +++ b/webapp_media.py @@ -65,6 +65,23 @@ def _add_embedded_video_from_sites(translate: {}, content: str, "allowfullscreen>\n\n" return content + video_site = 'https://youtu.be/' + if '"' + video_site in content: + url = content.split('"' + video_site)[1] + if '"' in url: + url = 'embed/' + url.split('"')[0] + if '&' in url: + url = url.split('&')[0] + if '?utm_' in url: + url = url.split('?utm_')[0] + content += \ + "
\n\n
\n" + return content + invidious_sites = ( 'https://invidious.snopyta.org', 'https://yewtu.be',