From 3374803f4db8e7cd8decf0e7835e450c09590cf3 Mon Sep 17 00:00:00 2001 From: "David Adam (zanchey)" Date: Tue, 28 Dec 2010 00:27:12 +0800 Subject: [PATCH] XMLParse2: add basic support for content:encoded extension attributes --- XMLParse2.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/XMLParse2.py b/XMLParse2.py index 978b418..488a344 100644 --- a/XMLParse2.py +++ b/XMLParse2.py @@ -106,7 +106,11 @@ class XMLParse: except: blogItem.itemDate = 0 else: blogItem.itemDate = 0 - if entry.has_key('description'): + if entry.has_key('content'): + # get the contents of the first item with a text/html type + # no feeds without a text/html type have been encountered in the wild, but who knows + blogItem.contents = [content['value'] for content in entry['content'] if content['type'] == 'text/html'][0] + elif entry.has_key('description'): blogItem.contents = entry['description'] else: blogItem.contents = '(entry could not be retrieved)' -- 2.20.1