From: David Adam (zanchey) Date: Mon, 27 Dec 2010 16:27:12 +0000 (+0800) Subject: XMLParse2: add basic support for content:encoded extension attributes X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=3374803f4db8e7cd8decf0e7835e450c09590cf3;p=planet-ucc.git XMLParse2: add basic support for content:encoded extension attributes --- 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)'