Quantcast
Channel: How do I access pubDate for RSS items using Python feedparser? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Martin Burch for How do I access pubDate for RSS items using Python feedparser?

$
0
0

feedparser is an opinionated parser, not simply returning XML in a dictionary. The text of pubDate is available as entries[i].published.

The date this entry was first published, as a string in the same format as it was published in the original feed.

Working code:

for entry in rss_object.entries:    print entry.published

Note: published is extracted from one of several possible XML tags depending on the format of the feed. See the reference manual for a list.

This manual also claims the pubDate element is parsed "as a date" in entries[i].published_parsed. What's in published_parsed is a time.struct_time object; you may want to re-parse the date yourself to maintain time zone information, if the original feed included time zones.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images