From dffee4d223d2e2e3ba5daa5387ba7713e152bf18 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 24 Apr 2019 15:46:54 +0100 Subject: Move REGEX_URL out of isgd.py and title.py in to utils.http --- modules/isgd.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modules/isgd.py') diff --git a/modules/isgd.py b/modules/isgd.py index b97af5b1..cfc94ebb 100644 --- a/modules/isgd.py +++ b/modules/isgd.py @@ -2,14 +2,13 @@ import re from src import ModuleManager, utils ISGD_API_URL = "https://is.gd/create.php" -REGEX_URL = re.compile("https?://\S+", re.I) class Module(ModuleManager.BaseModule): def on_load(self): self.exports.add("shortlink", self._shortlink) def _shortlink(self, url): - if not re.match(REGEX_URL, url): + if not re.match(utils.http.REGEX_URL, url): url = "http://%s" % url page = utils.http.request(ISGD_API_URL, get_params= @@ -28,9 +27,9 @@ class Module(ModuleManager.BaseModule): if len(event["args"]) > 0: url = event["args_split"][0] else: - url = event["target"].buffer.find(REGEX_URL) + url = event["target"].buffer.find(utils.http.REGEX_URL) if url: - url = re.search(REGEX_URL, url.message).group(0) + url = re.search(utils.http.REGEX_URL, url.message).group(0) if not url: raise utils.EventError("No URL provided/found.") -- cgit v1.3.1-10-gc9f91