replace /r/place links everywhere

pull/173/head
Aevann 2023-07-22 13:18:33 +03:00
parent 37c9307fc4
commit 95aa13b237
2 changed files with 1 additions and 6 deletions

View File

@ -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

View File

@ -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)