Add support for reddit.com feeds

The content of the linked article is used for the content. The original content (with a link to comments) is still available in the "description" of the feed item.
master
pictuga 2013-06-11 13:02:47 +02:00
parent f0b237364f
commit d2418a47c2
1 changed files with 7 additions and 0 deletions

View File

@ -346,6 +346,13 @@ def Fill(rss, cache, feedurl="/", fast=False):
item.link = "".join([(t[s[0]] if s[0] in t else "=") + s[1:] for s in url[1:]])
log(item.link)
# reddit
if urlparse.urlparse(item.link).netloc == 'www.reddit.com':
match = lxml.html.fromstring(item.desc).xpath('//a[text()="[link]"]/@href')
if len(match):
item.link = match[0]
log(item.link)
# check relative urls
if urlparse.urlparse(item.link).netloc is '':
item.link = urlparse.urljoin(feedurl, item.link)