diff --git a/files/helpers/regex.py b/files/helpers/regex.py index c40c910593..d1761593f2 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -90,7 +90,7 @@ ascii_only_regex = re.compile("[ -~]+", flags=re.A) twitter_to_nitter_regex = re.compile("https:\/\/twitter.com\/(\w{4,15}(\/status\/\d+[^/]*)?)", flags=re.A) -reddit_domain_regex = re.compile("(^|\s|\()https?:\/\/(reddit\.com|new\.reddit.com|www\.reddit.com|i\.reddit\.com|redd\.it|libredd\.it|teddit\.net)\/r\/", flags=re.A) +reddit_domain_regex = re.compile("(^|\s|\()https?:\/\/(reddit\.com|new\.reddit.com|www\.reddit.com|i\.reddit\.com|libredd\.it|teddit\.net)\/(r|u)\/", flags=re.A) color_regex = re.compile("[a-z0-9]{6}", flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index a93647e1da..2acc9d777d 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -399,7 +399,7 @@ def filter_emojis_only(title, edit=False, graceful=False): else: return title.replace('\n','').strip() def normalize_url(url): - url = reddit_domain_regex.sub(r'\1https://old.reddit.com/r/', url) + url = reddit_domain_regex.sub(r'\1https://old.reddit.com/\2/', url) url = url.replace("https://youtu.be/", "https://youtube.com/watch?v=") \ .replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=") \