1
0
mirror of https://github.com/sjlongland/tornado-news.git synced 2025-09-13 10:03:14 +10:00

Fix handling of 'content'

This commit is contained in:
Stuart Longland 2016-03-06 16:23:18 +10:00
parent 10f2c56945
commit 16ad2d14e1
Signed by: stuartl
GPG Key ID: 4DFA191410BDE3B7

View File

@ -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):