summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2014-01-06 01:18:33 +0100
committertv <tv@nomic.retiolum>2014-01-06 01:18:33 +0100
commit5d194fb02e34fa8459e437449ef5bb466f0b4fb0 (patch)
tree33e6166a71fbbca30d3eff787823fe50604aa5a1
parent7a597d42b0a4cfdf4e96a10ffecea442bdff3ac0 (diff)
parent2371e50bf2c8ea1f85b20b549a092bde9aa4854d (diff)
Merge branch 'master' of https://github.com/krebscode/painload
-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: