feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

should entry.tags be defined even when empty?

Open JoeGermuska opened this issue 3 years ago • 1 comments

I have two different RSS feeds, both of which have a number of elements at the xpath /rss/channel/item/category, which, according to the docs, is one source for tags (categories) on elements.

However, when feedparser parses them, entries from one have tags, and entries from the other do not.

This feed, https://seekingalpha.com/feed.xml, comes up with plentiful tags, even though the RSS does not validate This feed, https://rss.nytimes.com/services/xml/rss/nyt/World.xml, throws AttributeError when entry.tags is accessed, even though the RSS does validate.

Am I missing something? Is it a bug?

JoeGermuska avatar Jul 12 '22 16:07 JoeGermuska

My bad... I didn't read the feed XML carefully, and it just so happened that the first element in the NYT feed didn't have categories.

So I guess I was surprised that the parsed feed entry throws AttributeException when there are no tags, instead of returning an empty list.

JoeGermuska avatar Jul 13 '22 14:07 JoeGermuska