diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 95ff0d3dd..c5ca2fc2e 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -199,9 +199,9 @@ def sanitize(sanitized, noimages=False): elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): sanitized = re.sub(f'(?', sanitized, flags=re.I) - sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?a=").replace("https://music.youtube.com/watch?a=", "https://youtube.com/watch?a=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?a=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube") + sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube") - if "https://youtube.com/watch?a=" in sanitized: sanitized = sanitized.replace("?t=", "&t=") + if "https://youtube.com/watch?v=" in sanitized: sanitized = sanitized.replace("?t=", "&t=") for i in re.finditer('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))', sanitized): url = i.group(1) diff --git a/files/routes/posts.py b/files/routes/posts.py index 4005d8a47..a7077a9c8 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -749,7 +749,7 @@ def submit_post(v): for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: url = url.replace(rd, "https://old.reddit.com/") - url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?a=").replace("https://music.youtube.com/watch?a=", "https://youtube.com/watch?a=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?a=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") + url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube") if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/") @@ -785,8 +785,8 @@ def submit_post(v): elif "twitter.com" == domain: try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"] except: embed = None - elif url.startswith('https://youtube.com/watch?a='): - yt_id = url.split('https://youtube.com/watch?a=')[1].split('&')[0].split('%')[0] + elif url.startswith('https://youtube.com/watch?v='): + yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0] params = parse_qs(urlparse(url).query) t = params.get('t', params.get('start', [0]))[0] if isinstance(t, str): t = t.replace('s','') diff --git a/files/routes/settings.py b/files/routes/settings.py index eb3f53c62..a96f80974 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -1046,7 +1046,7 @@ def settings_song_change(v): return redirect("/settings/profile") song = song.replace("https://music.youtube.com", "https://youtube.com") - if song.startswith(("https://www.youtube.com/watch?a=", "https://youtube.com/watch?a=", "https://m.youtube.com/watch?a=")): + if song.startswith(("https://www.youtube.com/watch?v=", "https://youtube.com/watch?v=", "https://m.youtube.com/watch?v=")): id = song.split("v=")[1] elif song.startswith("https://youtu.be/"): id = song.split("https://youtu.be/")[1] @@ -1099,7 +1099,7 @@ def settings_song_change(v): } with youtube_dl.YoutubeDL(ydl_opts) as ydl: - try: ydl.download([f"https://youtube.com/watch?a={id}"]) + try: ydl.download([f"https://youtube.com/watch?v={id}"]) except Exception as e: print(e) if not v or v.oldsite: template = '' diff --git a/files/templates/CHRISTMAS/errors/429.html b/files/templates/CHRISTMAS/errors/429.html index feeaf31e6..7e6ece9cd 100644 --- a/files/templates/CHRISTMAS/errors/429.html +++ b/files/templates/CHRISTMAS/errors/429.html @@ -14,7 +14,7 @@

go spam somewhere else nerd

- Go to frontpage + Go to frontpage {% endblock %} diff --git a/files/templates/CHRISTMAS/sidebars/SubmitSidebar.html b/files/templates/CHRISTMAS/sidebars/SubmitSidebar.html index bca76a49d..6807fbebb 100644 --- a/files/templates/CHRISTMAS/sidebars/SubmitSidebar.html +++ b/files/templates/CHRISTMAS/sidebars/SubmitSidebar.html @@ -15,7 +15,7 @@
- + cozy fireplace log fire \ No newline at end of file diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 1884b3fb9..b117f7163 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -58,7 +58,7 @@ You can use Markdown formatting: Youtube Videos - https://youtube.com/watch?a=3Hecr51ByE4 + https://youtube.com/watch?v=3Hecr51ByE4