feedparser
feedparser copied to clipboard
feedparser cannot parse multiple "category" value?
According to RSS 2.0 Specification, category item may include multiple values.
You may include as many category elements as you need to, for different domains, and to have an item cross-referenced in different parts of the same domain.
There's a sample including multiple category values as below.
- http://www.validome.org/check/RSS_validator/version/rss_2_0/action/xml/feed/234
>>> import feedparser
>>> feedparser.__version__
'5.2.1'
>>> data = feedparser.parse('http://www.validome.org/check/RSS_validator/version/rss_2_0/action/xml/feed/234')
>>> data.feed.get('category')
u'category/subcategory/subcategory2'
Is this a bug?
I found tags handles multiple category values. We have a workaround.
>>> data.feed.get('tags')
[{'label': None,
'scheme': u'http://www.validome.org/cat1/',
'term': u'category/subcategory/subcategory2'},
{'label': None,
'scheme': u'http://www.validome.org/cat2',
'term': u'category/subcategory/subcategory3'}]