Support for wikipedia fetured articles feed

Should work with most wikipedias
master
pictuga 2014-05-18 12:17:14 +02:00
parent d8a3c4e9af
commit c41a1fe226
1 changed files with 7 additions and 0 deletions

View File

@ -350,6 +350,13 @@ def Fix(item, feedurl='/'):
log('no link') log('no link')
return item return item
# wikipedia daily highlight
if fnmatch(feedurl, 'http*://*.wikipedia.org/w/api.php?*&feedformat=atom'):
match = lxml.html.fromstring(item.desc).xpath('//b/a/@href')
if len(match):
item.link = match[0]
log(item.link)
# check relative urls # check relative urls
item.link = urlparse.urljoin(feedurl, item.link) item.link = urlparse.urljoin(feedurl, item.link)