Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 683075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:40:01+00:00 2026-05-14T01:40:01+00:00

trying to get my head around Feedzirra here. I have it all setup and

  • 0

trying to get my head around Feedzirra here.

I have it all setup and everything, and can even get results and updates, but something odd is going on.

I came up with the following code:

  def initialize(feed_url)
    @feed_url = feed_url
    @rssObject =  Feedzirra::Feed.fetch_and_parse(@feed_url)
  end

  def update_from_feed_continuously()    
    @rssObject = Feedzirra::Feed.update(@rssObject)
    if @rssObject.updated?
      puts @rssObject.new_entries.count
    else
      puts "nil"
    end
  end

Right, what I’m doing above, is starting with the big feed, and then only getting updates. I’m sure I must be doing something stupid, as even though I’m able to get the updates, and store them on the same instance variable, after the first time, I’m never able to get those again.

Obviously this happens because I’m overwriting my instance variable with only updates, and lose the full feed object.

I then thought about changing my code to this:

  def update_from_feed_continuously()    
    feed = Feedzirra::Feed.update(@rssObject)
    if feed.updated?
      puts feed.new_entries.count
    else
      puts "nil"
    end
  end

Well, I’m not overwriting anything and that should be the way to go right?

WRONG, this means I’m doomed to always try to get updates to the same static feed object, as although I get the updates on a variable, I’m never actually updating my “static feed object”, and newly added items will be appended to my “feed.new_entries” as they in theory are new.

I’m sure I;m missing a step here, but I’d really appreciate if someone could shed me a light on it. I’ve been going through this code for hours, and can’t get to grips with it.

Obviously it should work fine, if I did something like:

if feed.updated?
  puts feed.new_entries.count
  @rssObject = initialize(@feed_url)
else

Because that would reinitialize my instance variable with a brand new feed object, and the updates would come again.

But that also means that any new update added on that exact moment would be lost, as well as massive overkill, as I’d have to load the thing again.

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:40:02+00:00Added an answer on May 14, 2026 at 1:40 am

    How to do updates is a bit counterintuitive with the current API. This example shows the best way to do it:

    # I'm using Atom here, but it could be anything. You don't need to know ahead of time.
    # It will parse out to the correct format when it updates.
    feed_to_update = Feedzirra::Parser::Atom.new
    feed_to_update.feed_url = some_stored_feed_url
    feed_to_update.etag = some_stored_feed_etag
    feed_to_update.last_modified = some_stored_feed_last_modified
    
    last_entry = Feedzirra::Parser::AtomEntry.new
    last_entry.url = the_url_of_the_last_entry_for_a_feed
    
    feed_to_update.entries = [last_entry]
    
    updated_feed = Feedzirra::Feed.update(feed_to_update)
    
    updated_feed.updated? # => nil if there is nothing new
    updated_feed.new_entries # => [] if nothing new otherwise a collection of feedzirra entries
    updated_feed.etag # => same as before if nothing new. although could change with comments added to entries.
    updated_feed.last_modified # => same as before if nothing new. although could change with comments added to entries.
    

    Basically, you’ll have to save off four pieces of data (feed_url,
    last_modified, etag, and the url of the most recent entry). Then when you
    want to do updates you construct a new feed object and call update on
    that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to get my head around what can happen when things go wrong
I'm trying to get my head around the covariance of Scala's collections. I have
I'm trying to get my head around the addressing of WCF services. We have
am trying to get my head around the following: Have a small program am
I'm trying to get my head around the dbpedia JSON schema and can't figure
I'm trying to get my head around three20. It's a big beast, but I
I'm trying to get my head around a query and I just can't figure
Im trying to get my head around MySQL. I have learnt a great deal
I'm trying to get my head around solving the following problem. I have the
Really trying to get my head around this but cannot see the light through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.