fix /r/place links

pull/172/head
Aevann 2023-07-20 22:50:06 +03:00
parent 9fea2f21da
commit 7a0d2c7936
1 changed files with 5 additions and 2 deletions

View File

@ -19,15 +19,18 @@ 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', 'https://new.reddit.com/r/place')
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('https://old.reddit.com/r/place', 'https://new.reddit.com/r/place')
body = body.replace(f'https://{v.reddit}/r/place', 'https://new.reddit.com/r/place')
return body