xralf
xralf

Reputation: 3632

Detecting new RSS feed entries

I'm using feedparser for working with RSS. I'm getting regularly (e.g. every 15 minutes) RSS channel with items and store it. In the channels there aren't often any new items. So, it's unefficient.
Is there a way to detect quickly if there are some new items in the channel and if not, do nothing with this channel?

thank you

Upvotes: 0

Views: 757

Answers (1)

ViennaMike
ViennaMike

Reputation: 2337

For RSS 2.0, the channel element has an optional lastBuildDate eleement. For atom, there's a similar "atom:updated" element, but the standard does state that this is when "an entry or feed was modified in a way the publisher considers significant. Therefore, not all modifications necessarily result in a changed atom:updated value".

There's also a PubDate element in RSS 2.0, also optional, but lastBuildDate should be the one to use, assuming it's there and the publisher is using it correctly.

You can store the previous one and compare the newly retrieved value with the old one.

Added material on feedparser: For feedparser, see feed-updated_parsed and feed-updated.

Upvotes: 1

Related Questions