forked from rDrama/rDrama
replace /r/place links everywhere
parent
37c9307fc4
commit
95aa13b237
|
@ -19,19 +19,13 @@ from files.helpers.sorting_and_time import *
|
||||||
from .saves import CommentSaveRelationship
|
from .saves import CommentSaveRelationship
|
||||||
|
|
||||||
def normalize_urls_runtime(body, v):
|
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 not v: return body
|
||||||
|
|
||||||
if v.reddit != 'old.reddit.com':
|
if v.reddit != 'old.reddit.com':
|
||||||
body = reddit_to_vreddit_regex.sub(rf'\1https://{v.reddit}/\2/', body)
|
body = reddit_to_vreddit_regex.sub(rf'\1https://{v.reddit}/\2/', body)
|
||||||
if v.nitter:
|
if v.nitter:
|
||||||
body = twitter_to_nitter_regex.sub(r'\1https://nitter.lacontrevoie.fr/', body)
|
body = twitter_to_nitter_regex.sub(r'\1https://nitter.lacontrevoie.fr/', body)
|
||||||
if v.imginn:
|
if v.imginn:
|
||||||
body = body.replace('https://instagram.com/', 'https://imginn.com/')
|
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
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -674,6 +674,7 @@ def normalize_url(url):
|
||||||
.replace("https://nitter.42l.fr/", "https://twitter.com/") \
|
.replace("https://nitter.42l.fr/", "https://twitter.com/") \
|
||||||
.replace("https://nitter.lacontrevoie.fr/", "https://twitter.com/") \
|
.replace("https://nitter.lacontrevoie.fr/", "https://twitter.com/") \
|
||||||
.replace("/giphy.gif", "/giphy.webp") \
|
.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 = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=grand', url)
|
||||||
url = giphy_regex.sub(r'\1.webp', url)
|
url = giphy_regex.sub(r'\1.webp', url)
|
||||||
|
|
Loading…
Reference in New Issue