From 16ad2d14e12a05de26281961006dd2c4d1ca958f Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Sun, 6 Mar 2016 16:23:18 +1000 Subject: [PATCH] Fix handling of 'content' --- tornadonews/tornadonews.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tornadonews/tornadonews.py b/tornadonews/tornadonews.py index 63bf604..b92cdd3 100644 --- a/tornadonews/tornadonews.py +++ b/tornadonews/tornadonews.py @@ -69,12 +69,18 @@ class FeedEntry(object): Parse the feedparser-generated entry dict and return a FeedEntry object from it. """ + if 'content' in entry: + html_content = filter(lambda c : 'html' in c['type'], entry['content']) + content = ''.join([c['value'] for c in html_content]) + else: + content = entry['summary'] + return cls( source, entry['id'], entry['link'], entry['title'], entry.get('author') or 'Anonymous', timegm(entry.get('updated_parsed') or \ entry['published_parsed']), - entry.get('content') or entry['summary']) + content) @property def raw(self):