Waiting for Lion to show up in App Store? We are too. Here’s how we are checking.
When you want to pull a URL from Mac App Store, you need to emulate its user agent. curl -silent -A “iMacAppStore/1.0.1 (Macintosh; U; Intel Mac OS X 10.6.7; en) AppleWebKit/533.20.25” will do that for you.
Want to search the store? Same idea, but give it a query like this: curl -A “iMacAppStore/1.0.1 (Macintosh; U; Intel Mac OS X 10.6.7; en) AppleWebKit/533.20.25” -H “X-Apple-Store-Front: 143441-1,13” ‘http://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?q=SEARCH_PHRASE_HERE’
The search phrase must be URL-escaped, e.g. “OS X Lion” is “OS%20X%20Lion”.
Then do a little grep-fu, namely grep -iv ‘killer’ | grep ‘mt=12’ | grep ‘class=.name’ These steps search for app listings only whose name does not include “killer”, as in “Killer Guide for OS X Lion”. Who knew?
I threw together a few utilities to help with this. Lionscanner is a command line app that performs this search (or, if you give it an argument searches for that instead of “OS X Lion”) and then processes the results to kill everything but in-line text, i.e. no XML tags, following the greps I mentioned above.
If you run it without arguments it hunts for “OS X Lion”. If it finds nothing, there’s no “OS X Lion” product in App Store. Presumably. That’s why I’ve also included the basic how-to. So you can create your own tools that are a little more flexible in case Apple doesn’t name it quite “OS X Lion”.
Second, I have my handy-dandy-age-of-the-dinosaurs-csh-script as always, the one you readers always mock me for. Still works, still csh, you still need to run it with something like repeat 5000 ./doLionCheck:
#! /bin/csh
./lionscanner | grep -i “lion” > /dev/null
if ($? == 0) then
echo “Available”
say “LION MAY BE AVAILABLE”
else
echo “Nada”
endif
sleep 600
Okay, that’s everything you need. Don’t forget to make stuff executable (chmod 755). Now go forth and build some better tools for us.
Waiting for Lion: On your mark, get set, geek out originally appeared on TUAW – The Unofficial Apple Weblog on Thu, 14 Jul 2011 03:00:00 EST. Please see our terms for use of feeds.
Source | Permalink | Email this | Comments