开发者

Detecting new RSS feed entries

开发者 https://www.devze.com 2023-03-10 06:24 出处:网络
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

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

精彩评论

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

关注公众号