PearComp |
Pear Computer LLP is a fresh mobile software company from Cambridge, UK. We create usable and beautiful iPhone apps, like KashFlow and MyGas. We can also help you and your business to turn your app idea into reality. |
Every iPhone developer wants to know how his apps are doing. While Apple tells you about sales and traffic, you can’t really compare your app to the competition. Although this information is available in iTunes in the form of a “ranking” of the top 100 applications in each category, there is no way of getting to it other than clicking through all the pages in iTunes by hand. What makes things worse is that there are many stores, and the rankings will be different in each store and category.
Not too long ago, Ben Chatelain wrote a perl script, based on Erica Sadun’s previous work, to exctract the rankings for an app identified by its ID from any iTunes Application Store in the world. Unfortunately, it seems that Apple keeps changing the XML format that these web services return. The original Perl script by Ben was subsequently modified by the guys at touchcentric to make it faster and easier to use.
Last week I downloaded the perl script from their website and tried to get statistics for our new app, Point Don’t Shout. As it turned out, the script didn’t work for me. I traced it down to the regular expression that digests the XML returned by Apple and extracts an app’s rank, id and name. It seems that Apple was kind enough to change their format, once again.
I set out to fixing this issue and modified the Perl script again. However, as the format has become more complicated, I decided to properly parse the XML using XML::TreeBuilder, a nice and simple XML DOM style parser for Perl. I also cleaned up the code and removed some unused functions as well as modifying the way caching was handled previously.
The new script can be downloaded here. Please let me know if you run into problems, or if you are overjoyed to use this little piece of code.