# How come i cant grab all rss items from a feed

**URL:** <https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704>\
**Category:** Ruby\
**Created:** [April 4, 2009, 12:28pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704 "2009-04-04T12:28:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 4, 2009, 12:28pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/1 "2009-04-04T12:28:56Z")

</div>

When i try and access the bbc feed it will only return the latest 40  
results. However if i use the same feed in google reader, it can return  
a lot more. Why is this and how do i modify the code below so that i can  
return more results.

Heres some code

require ‘rss/1.0’  
require ‘rss/2.0’  
require ‘open-uri’  
require ‘rss/parser’

source =  
“[\<![CDATA[BBC News - UK]]\>](http://newsrss.bbc.co.uk/rss/newsonline_world_edition/uk_news/rss.xml)”

# url or local file

content = “” # raw content of rss feed will be loaded here  
open(source) do |s| content = s.read end  
rss = RSS::Parser.parse(content, false)

(rss.items.length == 40ish)

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 4, 2009, 1:20pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/2 "2009-04-04T13:20:52Z")

</div>

I’d suggest you check which headers your browser is sending.  
Particularly  
the Last-Modified and Etag. Replicate those and you will see the same  
amount  
of items.  
Ben

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 4, 2009, 4:37pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/3 "2009-04-04T16:37:36Z")

</div>

hi ben, thanks for the reply. Im a bit confused though.

When i type the address into the browser it shows 40 items just as the  
code above does.

When i access the feed via google reader it shows more. I wondering what  
magic google is using to get more items than my browser or my rss code  
can.

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 4, 2009, 5:05pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/4 "2009-04-04T17:05:33Z")

</div>

Adam A. wrote:

> When i access the feed via google reader it shows more. I wondering what  
> magic google is using to get more items than my browser or my rss code  
> can.

I think this could be because google caches items internally, from the  
moment someone subscribes to the feed for the first time. Then it just  
periodically updates the feed and caches new items. To simulate google  
behavior you would need to go back in time and start fetching items from  
the moment you need.

Unless there’s some api on the feed itself, in which case you’d have to  
ask owners of the feed.

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 4, 2009, 6:39pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/5 "2009-04-04T18:39:17Z")

</div>

> When i access the feed via google reader it shows more. I wondering what  
> magic google is using to get more items than my browser or my rss code  
> can.

Ah I have to admit I glossed over the fact you were using Google Reader.  
As  
Snaury said, they would certainly employ caching at their end which  
should  
display results beyond the ones you are seeing.

Ben

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 5, 2009, 5:17am UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/6 "2009-04-05T05:17:26Z")

</div>

ahhh thank you for confirming my suspicions. Customized Deloreans with  
flux capacitors are a bit hard to come by these days so I guess ill have  
to settle with 40 a day.

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [April 5, 2009, 7:25pm UTC](https://www.ruby-forum.com/t/how-come-i-cant-grab-all-rss-items-from-a-feed/164704/7 "2009-04-05T19:25:32Z")

</div>

If it is utterly important you _could_ possibly use the google reader  
api to  
get at those entries. Might be a little easier than going back in time  
😉
