aboutsummaryrefslogtreecommitdiff
path: root/modules/rss.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-08-12 16:07:07 +0100
committerGravatar jesopo2019-08-12 16:07:07 +0100
commitd9426abec13df8f9743f49e7c87a2393c883e2b9 (patch)
treefa202261b842cec60ab8aa132bee3432deae661b /modules/rss.py
parentShow TTL for each record type from !dns (diff)
signature
suggest similar feeds when trying to remove an unknown feed
closes #100
Diffstat (limited to 'modules/rss.py')
-rw-r--r--modules/rss.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/rss.py b/modules/rss.py
index 42c333d1..41084e4c 100644
--- a/modules/rss.py
+++ b/modules/rss.py
@@ -1,7 +1,7 @@
#--depends-on config
#--depends-on shorturl
-import hashlib, time
+import difflib, hashlib, time
from src import ModuleManager, utils
import feedparser
@@ -153,7 +153,11 @@ class Module(ModuleManager.BaseModule):
url = utils.http.url_sanitise(event["args_split"][1])
if not url in rss_hooks:
- raise utils.EventError("I'm not watching that URL")
+ matches = difflib.get_close_matches(url, rss_hooks, cutoff=0.5)
+ if matches:
+ raise utils.EventError("Did you mean %s ?" % matches[0])
+ else:
+ raise utils.EventError("I'm not watching that URL")
rss_hooks.remove(url)
changed = True
message = "Removed RSS feed"