Saturday, April 10, 2010

Linking to an iTunes search via an app

In many of the radio station apps I've developed, the station wants a way for the listener to choose to buy on iTunes the current playing song. Since most stations don't provide the iTunes ID of the song as part of the "Now Playing" information, the best option I've been able to come up with is to have the app launch iTunes using a searching string.

For example, suppose the station was playing the song by the Talking Heads, called "And She Was". A station might simply provide this as "Talking Heads - And She Was" without any indication of who the artist is and what the song title is (other than what may, or may not be correctly inferred from the dash). Performing an iTunes search, this doesn't really matter.

You can use a URL like the following to do a blanket search on iTunes:

http://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?submit=edit&media=all&term=talking%20heads%20and%20she%20was

Simply launch this URL from within your app and iTunes will automatically launch and perform the requested search.

This will work on both iPhone and iPad. Please note: if you omit the "media=all" term, the search will return on error on the iPad.

You aren't limited to searching for music. You could also do a search for movies, or apps, etc.

1 comment:

Mike said...

Very useful! Thanks for posting. We have a page in our app listing other apps, and this is a nice alternative to have available.


All content copyright © 2009  Brian Stormont, unless otherwise noted.   All rights reserved.