summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2014-01-06 01:09:46 +0100
committerlassulus <lassulus@googlemail.com>2014-01-06 01:09:46 +0100
commit1ca2ea9a3a24ee6d19f61739e3b8363c108710d5 (patch)
treeaaca3ae34cbc09ff6a5ab63a67a365d238c88582
parentb74b6b26326dbbb6f62d8ad6388236f50e882263 (diff)
ircbot: subs url without regex
-rwxr-xr-xircbot/rssbot.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/ircbot/rssbot.py b/ircbot/rssbot.py
index 67f407ac..f0e19c5a 100755
--- a/ircbot/rssbot.py
+++ b/ircbot/rssbot.py
@@ -47,17 +47,14 @@ class RssBot(irc.bot.SingleServerIRCBot):
#try:
# self.send(entry.title + " " + entry.link + " com: " + entry.comments)
#except AttributeError:
- self.send(entry.title + " " + entry.link)
+ shorturl = subprocess.check_output(["curl", "-sS", "-F", "uri=" + entry.link, "http://wall:1337"]).decode()
+ self.send(entry.title + " " + shorturl)
self.oldnews.append(entry.link)
self.lastnew = datetime.now()
sleep(self.to)
def send(self, string):
- urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', string)
- for url in urls:
- shorturl = subprocess.check_output(["curl", "-sS", "-F", "uri=" + url, "http://wall:1337"]).decode()
- string = string.replace(url, shorturl)
if self.connection.connected:
for line in string.split('\n'):
if len(line) < 450: