feed: fix RSS link handling

This commit is contained in:
nemunaire 2019-02-02 19:44:47 +01:00
parent 20c19a72bc
commit 85c418bd06

View File

@ -82,11 +82,16 @@ class RSSEntry:
else:
self.summary = None
if len(node.getElementsByTagName("link")) > 0 and node.getElementsByTagName("link")[0].hasAttribute("href"):
self.link = node.getElementsByTagName("link")[0].getAttribute("href")
if len(node.getElementsByTagName("link")) > 0:
self.link = node.getElementsByTagName("link")[0].firstChild.nodeValue
else:
self.link = None
if len(node.getElementsByTagName("enclosure")) > 0 and node.getElementsByTagName("enclosure")[0].hasAttribute("url"):
self.enclosure = node.getElementsByTagName("enclosure")[0].getAttribute("url")
else:
self.enclosure = None
def __repr__(self):
return "<RSSEntry title='%s' updated='%s'>" % (self.title, self.pubDate)