Nice work! Daniel is pretty much spot on. We run the search term through a regex to see if the user has entered an iTunes URL first (as we accept either search terms or URLs), then we pass the search term to the search API listed above. There is a little magic in sorting the results and a little magic in combining results from the different international stores. We started with that though and it gets great results. There are a couple of (fairly old) Rails gems for it too.