views:

472

answers:

1

The iPhone makes it really simple to snarf down an image from the web; you can turn a URL into a UIImage in one line of code. So I'd like to enable my app (an educational puzzle game... my first!) to download some random images to make it more interesting and dynamic.

I thought about using Kodak's image of the day RSS feed, but I'm having quite a time figuring out how to parse it. Rather than being a simple list of image URLs, it seems to reference a bunch of "jhtml" URLs, which run Javascript to display the images in your RSS reader. Is this intentionally obfuscated, or am I missing some basic step to parse this?

I also tried the Astronomy Picture of the Day, via this RSS feed, but it's just the original page's HTML stuffed into CDATA... ugh.

So I guess this is really two questions:

  1. Is there a simple way to parse these feeds to actually get at the JPG URLs on the iPhone?
  2. Is there a better source for "picture of the day" type images?

PS: I'm using NSXMLParser, which I learned to use here.

A: 

I would recommend going with something that has an API, perhaps the Flickr "Interestingness" feed:

http://www.flickr.com/services/api/flickr.interestingness.getList.html

There is an objective-C library written to help with accessing Flickr but not sure if this API call is included:

http://github.com/lukhnos/objectiveflickr/tree/master

James Avery
Thanks for the API link. But I'm guessing that they'd consider my use of this API commercial (it will be sold in the app store). Still, a good thing to consider.
Limbic System