ruby on rails - Feedzirra - How to get updated RSS feed? -
the following code gist on feedzirra
updated content rss feed:
feed = feedzirra::feed.fetch_and_parse(feed_url) feed = feedzirra::feed.update(feed) do_something_with_new_feed(feed.new_entries) if feed.updated?
i don't understand how feedzirra know feed has been updated. can't working. in order know, have pass feed
object returned (minutes or hours ago) feedzirra::feed.fetch_and_parse(feed_url)
feedzirra::feed.update
, no? how know if has been updated if use feed had fetch_and_parse?
feeds (the sites accessing) can, don't necessarily, maintain 1 or 2 fields determine whether have changed since last access. these etag , last modified. if site supports either or both of these, returned when access feed. model should maintain these fields each feed of interest. feedzirra::feed.update uses them determine whether or not feed has been updated since last access. these allow feedzirra::feed.update pull entries new or changed since last access.
if have neither etag nor last modified fields, either because first access or because site doesn't provide them, feedzirra::feed.fetch_and_parse pulls entries available site. makes sense first access. makes less sense subsequent accesses, if site doesn't support can do?
to clear, feedzirra::feed.fetch_and_parse pulls available entries. feedzirra::feed.update pulls entries new or changed since etag and/or last modified date provided it.
entries maintain update/published date well.
Comments
Post a Comment