Aevann 2024-01-12 10:16:39 +02:00
parent 476d6994b4
commit 56f68c45c4
2 changed files with 3 additions and 1 deletions

View File

@ -69,7 +69,7 @@ def normalize_urls_runtime(body, v):
body = twitter_to_nitter_regex.sub(r'\1https://nitter.net/', body)
if v and v.imgsed:
body = body.replace('https://instagram.com/', 'https://imgsed.com/')
body = instagram_to_imgsed_regex.sub(r'\1https://imgsed.com/', body)
if not v or v.controversial:
captured = []

View File

@ -128,6 +128,8 @@ allowed_domain_regex = re.compile("[a-z0-9\-.]+", flags=re.I|re.A)
twitter_to_nitter_regex = re.compile('(^|>|")https:\/\/twitter.com\/(?!i\/)', flags=re.A)
instagram_to_imgsed_regex = re.compile('(^|>|")https:\/\/instagram.com\/(?!reel\/)', flags=re.A)
color_regex = re.compile("[a-f0-9]{6}", flags=re.A)
# lazy match on the .*?, only match if there is trailing stuff