diff options
author | lassulus <lassulus@googlemail.com> | 2014-01-06 00:24:51 +0100 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2014-01-06 00:24:51 +0100 |
commit | b5a9bffee1ce0f51fa9637e08dbbe7bc8b32af05 (patch) | |
tree | b609a5e483778146faa06781396e5f09fa8e6965 /ircbot | |
parent | 53560d2554b6ab312176c802ff1d7eb413de09f4 (diff) |
ircbot: fixed everythink
Diffstat (limited to 'ircbot')
-rwxr-xr-x | ircbot/rssbot.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ircbot/rssbot.py b/ircbot/rssbot.py index 5fd30877..b73b4e41 100755 --- a/ircbot/rssbot.py +++ b/ircbot/rssbot.py @@ -31,6 +31,12 @@ class RssBot(irc.bot.SingleServerIRCBot): self.disconnect() def updateloop(self): + try: + self.feed = feedparser.parse(self.url) + except: + print(self.name + ': rss timeout occured') + for entry in self.feed.entries: + self.oldnews.append(entry.link) while self.loop: try: self.feed = feedparser.parse(self.url) @@ -46,15 +52,11 @@ class RssBot(irc.bot.SingleServerIRCBot): self.lastpull = datetime.now() sleep(self.to) - def sendall(self): - while len(self.sendqueue) > 0: - sleep(1) - self.send(self.sendqueue.pop()) 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", "-F", "uri=" + url, "http://127.0.0.1:1337"]) + shorturl = subprocess.check_output(["curl", "-F", "uri=" + url, "http://wall:1337"]).decode() string = string.replace(url, shorturl) if self.connection.connected: for line in string.split('\n'): |