diff options
| author | 2019-04-24 15:46:54 +0100 | |
|---|---|---|
| committer | 2019-04-24 15:46:54 +0100 | |
| commit | dffee4d223d2e2e3ba5daa5387ba7713e152bf18 (patch) | |
| tree | e9915697ee0b8df3efa39788e971ec9160170b71 /modules/isgd.py | |
| parent | `link` -> `url` (diff) | |
| signature | ||
Move REGEX_URL out of isgd.py and title.py in to utils.http
Diffstat (limited to 'modules/isgd.py')
| -rw-r--r-- | modules/isgd.py | 7 |
1 files changed, 3 insertions, 4 deletions
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.") |
