开发者

Detecting new RSS feed entries

I'm using feedparser for working with RSS. I'm getting regularly (e.g. every 15 minut开发者_C百科es) 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜