dewski / itunes

A Ruby wrapper around the iTunes API that lets you search for any sort of data that is available on the iTunes store.
http://github.com/dewski/itunes
MIT License
122 stars 29 forks source link

[feature] Parse RSS data #3

Open masterkain opened 13 years ago

masterkain commented 13 years ago

As seen here: http://itunes.apple.com/rss

stve commented 13 years ago

Nice find. I could envision a really nice DSL around the feeds, something like:

results = Itunes::Rss.country('UK').media_type('toppaidbooks').limit(10)
results.each { ... }
benmoss commented 13 years ago

Do you think you're gonna implement this?

I tried poking around in the code a little but it doesn't seem like it really fits into this gem. It'd require a lot of restructuring or just compartmentalizing of the code for the different endpoints.

masterkain commented 13 years ago

I was quickly tinkering around:

source = "http://itunes.apple.com/WebObjects/MZStore.woa/wpa/MRSS/newreleases/sf=143441/limit=10/explicit=true/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)

Seems to work, however source = "http://itunes.apple.com/us/rss/topalbums/limit=10/explicit=true/xml" Will not.

Anyway I'm still wondering about the Itunes classes defined here: http://rubydoc.info/stdlib/rss/1.8.7/RSS

stve commented 13 years ago

The more I think about it, the more I think this should be a separate gem. I've prototyped some code as well, how about something like this?

https://gist.github.com/1047870

You might also want to check out my itunes-charts gem which screen scrapes http://www.apple.com/itunes/charts/. I didn't realize RSS feeds were available when I wrote it.