kurtmckee / feedparser

Parse feeds in Python
https://feedparser.readthedocs.io/en/latest/
Other
1.89k stars 336 forks source link

Content attribute is inconsistent (sometimes a dict, sometimes a list of dicts) #448

Closed Dreamsorcerer closed 2 months ago

Dreamsorcerer commented 2 months ago

The documentation shows entry.content being a list: https://feedparser.readthedocs.io/en/latest/common-atom-elements.html#accessing-common-entry-elements And explicitly says that it is a list:

Because Atom entries can have more than one content element, d.entries[0].content is a list of dictionaries.

However, in reality I get a list on some feeds and a single dictionary on others.

List of dicts: https://mypy-lang.blogspot.com/feeds/posts/default Single dict: https://matrix.org/blog/feed

Expected behaviour is for the API to be consistent and always produce a list, regardless of the feed.

Dreamsorcerer commented 2 months ago

Nevermind, I think it was some manipulations I was doing.