From c41a1fe22648a9028203e1657d42b67f87bfa6d5 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sun, 18 May 2014 12:17:14 +0200 Subject: [PATCH] Support for wikipedia fetured articles feed Should work with most wikipedias --- morss/morss.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/morss/morss.py b/morss/morss.py index f7debd2..4cff19d 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -350,6 +350,13 @@ def Fix(item, feedurl='/'): log('no link') 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 item.link = urlparse.urljoin(feedurl, item.link)