Closed GoogleCodeExporter closed 9 years ago
Can you point me to a feed that's exhibiting this behavior?
Original comment by kurtmckee
on 7 Apr 2012 at 6:48
The feed used was
http://feeds.reuters.com/reuters/topNews?format=xml
which works fine with older versions of Feedparser.
Original comment by na...@animats.com
on 7 Apr 2012 at 4:11
This is due to a change in how the RSS element `pubDate` is stored in the
dictionary returned by feedparser. It used to be that `pubDate` mapped to the
`updated` key. However, `pubDate` represents when something was published, not
when it was updated. Consequently, `pubDate` maps to `published` now.
I guess as a convenience, `date` is automatically mapped to `updated` behind
the scenes. However, the information you're looking for is no longer in
`updated`: it's in `published`.
You'll need to update your code (or file a bug with the software you're using)
to check for `published` or `updated` as necessary. I recommend avoiding `date`
entirely.
Original comment by kurtmckee
on 7 Apr 2012 at 4:45
See
http://packages.python.org/feedparser/common-rss-elements.html
which claims to be the documentation for feedparser 5.1.1.
Accessing Common Item Elements (example)
...
>>> d.entries[0].date
Status: Developer in Denial.
Suggested workaround:
try : # feedparser >= 5.1.1
date = entry.published # publication date of entry
dateparsed = entry.published_parsed # date parsed
except AttributeError: # older feedparser
date = entry.date # feedparser < 5.1.1
dateparsed = entry.date_parsed
Original comment by na...@animats.com
on 7 Apr 2012 at 5:20
Oh snap, good catch! I'll update the documentation when I have an opportunity.
Thanks, John!
Original comment by kurtmckee
on 9 Apr 2012 at 4:22
Original issue reported on code.google.com by
na...@animats.com
on 7 Apr 2012 at 2:12