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
parent
f0b237364f
commit
d2418a47c2
7
morss.py
7
morss.py
|
@ -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:]])
|
item.link = "".join([(t[s[0]] if s[0] in t else "=") + s[1:] for s in url[1:]])
|
||||||
log(item.link)
|
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
|
# check relative urls
|
||||||
if urlparse.urlparse(item.link).netloc is '':
|
if urlparse.urlparse(item.link).netloc is '':
|
||||||
item.link = urlparse.urljoin(feedurl, item.link)
|
item.link = urlparse.urljoin(feedurl, item.link)
|
||||||
|
|
Loading…
Reference in New Issue