diff --git a/files/helpers/const.py b/files/helpers/const.py index 280972d00..493f21e72 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -670,7 +670,7 @@ marsey_regex = re.compile("[a-z0-9]{1,30}", flags=re.A) tags_regex = re.compile("[a-z0-9: ]{1,200}", flags=re.A) -image_regex = re.compile("(^https:\/\/.*\.(png|jpg|jpeg|gif|webp|maxwidth=9999|fidelity=high)($|\s))", flags=re.I|re.M|re.A) +image_regex = re.compile("(^https:\/\/[\w\-.#&/=\?@%+]+\.(png|jpg|jpeg|gif|webp|maxwidth=9999|fidelity=high)($|\s))", flags=re.I|re.M|re.A) valid_sub_regex = re.compile("^[a-zA-Z0-9_\-]{3,20}$", flags=re.A) @@ -688,18 +688,18 @@ title_regex = re.compile("[^\w ]", flags=re.A) based_regex = re.compile("based and (.{1,20}?)(-| )pilled", flags=re.I|re.A) -controversial_regex = re.compile('["> ](https:\/\/old\.reddit\.com/r/[a-zA-Z0-9_]{3,20}\/comments\/.*?)["< ]', flags=re.A) +controversial_regex = re.compile('["> ](https:\/\/old\.reddit\.com/r/[a-zA-Z0-9_]{3,20}\/comments\/[\w\-.#&/=\?@%+]+)["< ]', flags=re.A) fishylinks_regex = re.compile("https?://\S+", flags=re.A) -spoiler_regex = re.compile('\|\|(.*?)\|\|', flags=re.A) -video_regex = re.compile('
(https:\/\/.*?\.(mp4|webm|mov))<\/a><\/p>', flags=re.I|re.A)
-unlinked_regex = re.compile('''(^|\s| )(https:\/\/[^ <>"']*)''', flags=re.A)
-imgur_regex = re.compile('(https://i\.imgur\.com/([^_]*?))\.(jpg|png|jpeg|webp)(?!)', flags=re.A)
+spoiler_regex = re.compile('''\|\|([^/'"]+)\|\|''', flags=re.A)
+video_regex = re.compile(' (https:\/\/[\w\-.#&/=\?@%+]+\.(mp4|webm|mov))<\/a><\/p>', flags=re.I|re.A)
+unlinked_regex = re.compile('''(^|\s| )(https:\/\/[\w\-.#&/=\?@%+]+)''', flags=re.A)
+imgur_regex = re.compile('(https://i\.imgur\.com/([a-z0-9]+))\.(jpg|png|jpeg|webp)(?!)', flags=re.I|re.A)
reddit_regex = re.compile('(^|\s| )\/?((r|u)\/(\w|-){3,25})', flags=re.A)
sub_regex = re.compile('(^|\s| )\/?(h\/(\w|-){3,25})', flags=re.A)
-youtube_regex = re.compile('" target="_blank">(https://youtube\.com/watch\?v\=([a-z0-9-_]+).*?)\1', sanitized)
- sanitized = sanitized.replace("\ufeff", "").replace("𒐪","").replace("