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.