forked from MarseyWorld/MarseyWorld
make reddit_domain_regex work with user profiles too
parent
cc3137d730
commit
c0c5057ab9
|
@ -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)
|
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)
|
color_regex = re.compile("[a-z0-9]{6}", flags=re.A)
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
|
||||||
else: return title.replace('\n','').strip()
|
else: return title.replace('\n','').strip()
|
||||||
|
|
||||||
def normalize_url(url):
|
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=") \
|
url = url.replace("https://youtu.be/", "https://youtube.com/watch?v=") \
|
||||||
.replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=") \
|
.replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=") \
|
||||||
|
|
Loading…
Reference in New Issue