iTunes Portable AppStore

[ Features | How | Code | Instructions | Screenshots | Download | History | Links ]
{ .NET C# / Personal Idea / September 2008 }

I, like many others, own an Apple iPhone. One of the greatest features of the iPhone is the ability to install user created applications from the Apple AppStore. Now while it may be easy to install an application, browsing for one is difficult, time consuming, and overall frustrating. There is no simple web-interface; you have two choices: iPhone or iTunes, both of which are iAnnoying.

So, I took the time to develop a solution: the iTunes Portable AppStore.

The Portable AppStore is a small .NET application that gathers the important data from the Apple AppStore without the bulk of the iTunes interface. This program works by mimicking iTunes web calls and parsing out the returned XML data to leave behind the raw information.

Features

  • Clean and simple user interface
  • Ability to look at multiple applications at one time
  • View only the important information about an application
  • Browse through an application’s screenshots (up to 5)
  • Not made by Apple :lol:

How it Works

This is going to just be a quick summary of how to get and parse iTunes XML. For a more detailed breakdown and where the specific variables lie, read the article I wrote here.

After some quick investigation, I figured out that you can bypass the “Opening in iTunes” message by faking your browser identification (user-agent) as:

iTunes/8.0.2 (Macintosh; U; PPC Mac OS X 10.4.1)

or something similar.

As you can probably read in your browser, the resulting data is in a custom XML format. If you are not using a browser, you are probably seeing garbled text. This is because the returning data is gzip compressed and most browsers will automatically decompress it for you. If you are writing a program, like I did, you will have to decompress it yourself. Here is a C# example:

using System.IO.Compression;
  1.  
  2. HttpWebRequest reqFP = (HttpWebRequest)HttpWebRequest.Create(URL);
  3. HttpWebResponse rspFP = (HttpWebResponse)reqFP.GetResponse();
  4.  
  5. Stream responseStream = responseStream = rspFP.GetResponseStream();
  6.  
  7. if (rspFP.ContentEncoding.ToLower().Contains("gzip"))
  8.   responseStream = new GZipStream(responseStream,
  9.     CompressionMode.Decompress);

After we get our XML, the rest is simply parsing out the important stuff.

The Code

As I mentioned in my iTunes XML article, there is a lot of weeding to be done if you want to get to the important data. I’ll show how I get the application name, url, and image from the results page.

  1. // Take our responseStream from above
  2. using (StreamReader reader = new StreamReader(responseStream))
  3.   string content = reader.ReadToEnd();
  4.  
  5. // Create an XML object (using System.XML)
  6. XmlDocument xDoc = new XmlDocument();
  7. xDoc.LoadXml(content);
  8.  
  9. // Isolate the elements we need. (See iTunes XML article)
  10. XmlNodeList nodes = xDoc["Document"]["View"]["ScrollView"]
  11.   ["VBoxView"]["View"]["MatrixView"]["VBoxView"]["MatrixView"]
  12.   ["VBoxView"]["View"].ChildNodes[1]["VBoxView"]["VBoxView"]
  13.   ["MatrixView"].ChildNodes;
  14.  
  15. for (int x = 0; x < nodes.Count; x++) {
  16.   // If this element is a HBoxView, it is a result.
  17.   if (nodes[x].Name == "HBoxView") {
  18.     // Use this page to get the Application details
  19.     System.Console.WriteLine("App URL: " +
  20.       nodes[x]["VBoxView"]["MatrixView"]["GotoURL"]
  21.       .Attributes["url"].Value);
  22.  
  23.     // Here is the Application name
  24.     System.Console.WriteLine("App Name: " +
  25.       nodes[x]["VBoxView"]["MatrixView"]["GotoURL"]
  26.       .Attributes["draggingName"].Value);
  27.  
  28.     // And this is the URL of the Application icon
  29.     System.Console.WriteLine("Image URL: " +
  30.       nodes[x]["VBoxView"]["MatrixView"]["GotoURL"]["View"]
  31.       ["PictureView"].Attributes["url"].Value);
  32.   }
  33. }

Screenshots

Startup/About Screen

Startup/About Screen

Search Window

Search Window

Side-by-side Details of Applications

Side-by-side Details of Applications

Instructions

Run the program and click OK at the About screen to get to the Search window.  From there, type in your query and hit the button labeled “Search.”  Double-clicking on any of the results will open a new window populated with details about that specific application.

There is only one issue with the program.  It may hang while searching, loading data, or loading images.  This is a problem on Apple’s end.  For some odd reason, their servers can sometimes timeout responses, even while using the iTunes client.

Download

This program requires .NET Framework 3.5.

History

  • 25 June 2009 – v1.2 – Fixed crash caused by missing XML.
  • 25 November 2008 – v1.1 – iTunes changed image URLs. Updated user-agent string to 8.0.2
  • 15 September 2008 – v1.0 – First Release

Links/Resources

8 Comments

  1. Andreas K  •  Jun 5, 2009 @11:44 am

    The download seems to be 404. With firefox and with wget:

    andreas@andi-lap:~$ wget -S http://www.stjohnjohnson.com/download/iTunesPortableAppStore.exe
    –2009-06-05 18:43:22– http://www.stjohnjohnson.com/download/iTunesPortableAppStore.exe
    Auflösen des Hostnamen »www.stjohnjohnson.com«…. 97.74.198.55
    Verbindungsaufbau zu http://www.stjohnjohnson.com|97.74.198.55|:80… verbunden.
    HTTP Anforderung gesendet, warte auf Antwort…
    HTTP/1.1 404 Not Found
    Date: Fri, 05 Jun 2009 16:43:23 GMT
    Server: Apache/2.2.8 (Fedora)
    Content-Length: 332
    Connection: close
    Content-Type: text/html; charset=iso-8859-1
    2009-06-05 18:43:23 FEHLER 404: Not Found.

  2. Svyatoslav Litynskyy  •  Jun 15, 2009 @3:18 pm

    Where can i download iTunes Portable AppStore
    I am willing to pay for it if it downloads application info from appstore

  3. St. John  •  Jun 25, 2009 @6:54 pm

    Sorry about that guys, I moved servers and the downloads page wasn’t working correctly. It should be fixed now!

  4. ipod  •  Oct 1, 2009 @3:30 am

    Hi!
    Do you have any solution for php?

  5. Carsten  •  Oct 8, 2009 @10:51 am

    Hello John,

    realy good job you have done.

    is there any possibility to get your code in php, i would like to import him in my blog.

    thanks
    Carsten

  6. somebody  •  Nov 1, 2009 @6:04 am

    it does not work :(

  7. Hellrise  •  Nov 14, 2009 @10:59 am

    yes, it doesnt work now…

  8. kreisel.ray  •  Feb 9, 2010 @10:28 am

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



  • Donate

    If my work has helped you and you want to return the favor, you could purchase something for me from my Amazon Wish List or send me a donation via PayPal.

  • My Lifestream

  • License

    Unless otherwise noted, all source code and compiled files published on this website are released under the terms of the GNU Lesser General Public License.