Finally fix rssnotify

(and convert spaces to tabs)
master
sfan5 2014-07-23 10:17:18 +02:00
parent cedd28c2f6
commit dca95a9911
1 changed files with 105 additions and 101 deletions

View File

@ -3,7 +3,9 @@
rssnotify.py - Phenny RssNotify Module
Copyright 2013, sfan5
"""
import time, urllib.parse, re
import time
import re
import web
import feedparser # sudo pip install feedparser
rssnotify = {}
@ -82,16 +84,18 @@ def rsscheck(phenny, input):
continue
if rssnotify["show_commit_link"]:
if rssnotify["use_git.io"]:
params = urllib.parse.urlencode({'url' : feed_entry.link})
# Side note: git.io only works with *.github.com links
u = urllib.urlopen("http://git.io/create", params)
l = u.read()
l, code = web.post("http://git.io/create", {'url': feed_entry.link})
if code == 200:
l = str(l, 'utf-8')
if len(l.strip()) == 6:
commit_link = "http://git.io/" + l
else:
commit_link = feed_entry.link
else:
commit_link = feed_entry.link
else:
commit_link = feed_entry.link
else:
commit_link = ""