master
Aevann1 2021-09-01 23:01:54 +02:00
parent 9e443e37e5
commit 595f00beb6
1 changed files with 3 additions and 3 deletions

View File

@ -241,10 +241,10 @@ def sanitize(sanitized, noimages=False):
for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]:
sanitized = sanitized.replace(rd, "https://old.reddit.com/")
for i in re.finditer('[^">](https:\/\/[^ ]*)', sanitized):
sanitized = sanitized.replace(i.group(1), f"<a href={i.group(1)} {i.group(1)}</a>")
for i in re.finditer('[^">](https:\/\/.*?)( |<)', sanitized):
sanitized = sanitized.replace(i.group(1), f"<a href={i.group(1)} target='_blank'>{i.group(1)}</a>")
for i in re.finditer('<p>(https:\/\/[^ ]*)', sanitized):
sanitized = sanitized.replace(i.group(1), f"<a href={i.group(1)} {i.group(1)}</a>")
sanitized = sanitized.replace(i.group(1), f"<a href={i.group(1)} target='_blank'>{i.group(1)}</a>")
return sanitized