Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Howiieque

macrumors regular
Original poster
Feb 1, 2009
120
0
hello
i want to write an cocoa application that displays the top 10 songs of iTunes store. Is there a way to achieve this goal? Is there any APIs can take this task? Or maybe other methods? Please help?
 
I'm sure lots of time has been spent "hacking" the XML that is returned from iTunes store pages, but one approach might be to use the RSS feeds that apple makes public (the generator is here: http://ax.itunes.apple.com/rss) then build on that. It may not be directly applicable, but I grabbed the top ten from the command line like this:
Code:
curl "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/sf=143441/limit=10/explicit=true/xml" | grep "<title>" | awk -F[\<\>] '{print $3}'

If you need more that what the RSS will provide you, you're going to have to read up on properly requesting and parsing the other iTunes pages, which I'm sure is subject to change with each iTunes release.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.