feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

feedparser cannot parse multiple "category" value?

Open t2y opened this issue 10 years ago • 1 comments

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?

t2y avatar Nov 11 '15 13:11 t2y

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'}]

t2y avatar Nov 12 '15 00:11 t2y