Monday, November 16, 2009

ObSrv: Why only 21 images at a time?

Read More

Aaron asked a good question they other day.

Why does ObSrv only ever return 21 images at one time?

I thought it was a bug in my code, but it’s not. ObSrv pulls images from Google Image Search, and Google only ever returns 21 images in one go.

But this is not a problem. The images are embedded into a MediaRSS feed. That feed is cached for a maximum of one hour. After this time if you request the same feed, ObSrv will search again, but will only show images that it didn’t show last time. In the unlikely event that it runs out of images, it starts searching from the beginning again.

So although there’s nothing I can do about the 21 images at a time issue, it’s not a major problem because you will get more images after the feed refreshes – but remember, to save server resources (and to stop Google from banning me) it waits an hour between doing searches on the same terms.


Wopular said...

Hi, is there a way to contact you regarding the Google Image RSS feeds? I've been using it on my site, but it stopped working recently.

Neilius said...

Sure. My email is mail [at] neilennis [d0t] com. Just replace the [at] and [d0t] with an @ and a "." :)

I'm guessing you're using SimplePie?

My server was getting hammered a couple of times per second by one IP address using SimplePie, so I had to temporarily block that IP to redeuce the traffic.

If that's you, you will probably be getting a http 403 error.

It's easily fixed. You just need to change the refresh rate on SimplePie to something less frequent - e.g. hourly.

But please contact me at the above email address if I can help :)