forked from MarseyWorld/MarseyWorld
Revert "make the "https://" optional to embed a youtube video (I rly hope i dont regret this)"
This reverts commit 5ad46f3e53
.
master
parent
4d55acbfff
commit
002351a4e3
|
@ -87,7 +87,7 @@ imgur_regex = re.compile(f'(https:\/\/i\.imgur\.com\/[a-z0-9]+)\.({image_regex_e
|
|||
|
||||
giphy_regex = re.compile('(https:\/\/media\.giphy\.com\/media\/[a-z0-9]+\/giphy)\.gif', flags=re.I|re.A)
|
||||
|
||||
youtube_regex = re.compile('(<p>[^<]*)((https:\/\/)?youtube\.com\/watch\?[\w\-.#&/=?@%+]{7,})', flags=re.I|re.A)
|
||||
youtube_regex = re.compile('(<p>[^<]*)(https:\/\/youtube\.com\/watch\?[\w\-.#&/=?@%+]{7,})', flags=re.I|re.A)
|
||||
yt_id_regex = re.compile('[\w\-]{5,20}', flags=re.A)
|
||||
|
||||
link_fix_regex = re.compile("(\[.*?\]\()(?!http|\/)(.*?\))(?!([^<]*<\/(code|pre|a)>|[^`]*`))", flags=re.A)
|
||||
|
|
|
@ -576,13 +576,12 @@ def filter_emojis_only(title, golden=True, count_emojis=False, graceful=False, s
|
|||
def normalize_url(url):
|
||||
url = reddit_domain_regex.sub(r'\1https://old.reddit.com/\3/', url)
|
||||
|
||||
url = url.replace("youtu.be/", "youtube.com/watch?v=") \
|
||||
.replace("music.youtube.com/watch?v=", "youtube.com/watch?v=") \
|
||||
.replace("www.youtube.com", "youtube.com") \
|
||||
.replace("m.youtube.com", "youtube.com") \
|
||||
.replace("youtube.com/shorts/", "youtube.com/watch?v=") \
|
||||
.replace("youtube.com/v/", "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://www.youtube.com", "https://youtube.com") \
|
||||
.replace("https://m.youtube.com", "https://youtube.com") \
|
||||
.replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=") \
|
||||
.replace("https://youtube.com/v/", "https://youtube.com/watch?v=") \
|
||||
.replace("https://mobile.twitter.com", "https://twitter.com") \
|
||||
.replace("https://m.facebook.com", "https://facebook.com") \
|
||||
.replace("https://m.wikipedia.org", "https://wikipedia.org") \
|
||||
|
|
Loading…
Reference in New Issue