From 95aa13b2370420655c5e298182eb55f8d7fe8152 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 22 Jul 2023 13:18:33 +0300 Subject: [PATCH] replace /r/place links everywhere --- files/classes/comment.py | 6 ------ files/helpers/sanitize.py | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index d957a5188..eec116ebc 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -19,19 +19,13 @@ from files.helpers.sorting_and_time import * from .saves import CommentSaveRelationship def normalize_urls_runtime(body, v): - body = body.replace('https://old.reddit.com/r/place/?cx=', 'https://new.reddit.com/r/place/?cx=') - if not v: return body - if v.reddit != 'old.reddit.com': body = reddit_to_vreddit_regex.sub(rf'\1https://{v.reddit}/\2/', body) if v.nitter: body = twitter_to_nitter_regex.sub(r'\1https://nitter.lacontrevoie.fr/', body) if v.imginn: body = body.replace('https://instagram.com/', 'https://imginn.com/') - - body = body.replace(f'https://{v.reddit}/r/place/?cx=', 'https://new.reddit.com/r/place/?cx=') - return body diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index c1d9bb03f..3571b40e0 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -674,6 +674,7 @@ def normalize_url(url): .replace("https://nitter.42l.fr/", "https://twitter.com/") \ .replace("https://nitter.lacontrevoie.fr/", "https://twitter.com/") \ .replace("/giphy.gif", "/giphy.webp") \ + .replace('https://old.reddit.com/r/place/?', 'https://new.reddit.com/r/place/?') \ url = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=grand', url) url = giphy_regex.sub(r'\1.webp', url)