use re.compile on URL_REGEX
This commit is contained in:
parent
1ae9a3d09f
commit
67bec0508e
5
app.py
5
app.py
@ -10,8 +10,7 @@ from os import getenv
|
|||||||
PRICE_REGEX = re.compile(
|
PRICE_REGEX = re.compile(
|
||||||
"(?:(?P<currency>[GBP|EUR|£|€])(?P<price>[0-9]+(?:\.[0-9]{1,2})))")
|
"(?:(?P<currency>[GBP|EUR|£|€])(?P<price>[0-9]+(?:\.[0-9]{1,2})))")
|
||||||
MODEL_REGEX = re.compile("[Rr][Tt][Xx] ?(?P<model>30[6789]0( [Tt][Ii])?).?")
|
MODEL_REGEX = re.compile("[Rr][Tt][Xx] ?(?P<model>30[6789]0( [Tt][Ii])?).?")
|
||||||
|
URL_REGEX = re.compile("(?:(?:https?|ftp):\/\/|\b(?:[a-z\d]+\.))(?:(?:[^\s()<>]+|\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))?\))+(?:\((?:[^\s()<>]+|(?:\(?:[^\s()<>]+\)))?\)|[^\s`!()\[\]{};:'.,<>?«»“”‘’]))?")
|
||||||
URL_REGEX = "(?:(?:https?|ftp):\/\/|\b(?:[a-z\d]+\.))(?:(?:[^\s()<>]+|\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))?\))+(?:\((?:[^\s()<>]+|(?:\(?:[^\s()<>]+\)))?\)|[^\s`!()\[\]{};:'.,<>?«»“”‘’]))?"
|
|
||||||
|
|
||||||
PARTALERT_ASIN = re.compile("asin=(?P<asin>[0-9a-zA-Z]{1,10})")
|
PARTALERT_ASIN = re.compile("asin=(?P<asin>[0-9a-zA-Z]{1,10})")
|
||||||
PARTALERT_TLD = re.compile("tld=(?P<tld>\.(?:it|es|de|fr|co\.uk))")
|
PARTALERT_TLD = re.compile("tld=(?P<tld>\.(?:it|es|de|fr|co\.uk))")
|
||||||
@ -122,7 +121,7 @@ def on_message(resp):
|
|||||||
content = m['content']
|
content = m['content']
|
||||||
|
|
||||||
if channelID in MONITORED_CHANNELS:
|
if channelID in MONITORED_CHANNELS:
|
||||||
urls = re.findall(URL_REGEX, content)
|
urls = URL_REGEX.findall(content)
|
||||||
|
|
||||||
if (urls):
|
if (urls):
|
||||||
check_urls(urls)
|
check_urls(urls)
|
||||||
|
Loading…
Reference in New Issue
Block a user