MacUpdate.com download counter

Want to know how many downloads a program that is hosted at macupdate has? use this handy script! all you do is enter the 5 digit number in the programs url over at macupdate and presto


set theURL to text returned of (display dialog "Please enter the program's unique 5 digit MacUpdate number." default answer "" default button 2)
set theHTMLSource to (do shell script "curl " & "http://www.macupdate.com/info.php/id/" & theURL)

(* Chop off all of the text before the number *)
set AppleScript's text item delimiters to {"Downloads:</td><td class='value'>"}
set theHTMLSource2 to text item 2 of theHTMLSource

(* Chop off all of the text after the number *)
set AppleScript's text item delimiters to {"<"}
set downloadcount to text item 1 of theHTMLSource2
(* Chop off all of the text before the number *)
set AppleScript's text item delimiters to {"<div class='prod_title'>"}
set source2 to text item 2 of theHTMLSource

(* Chop off all of the text after the number *)
set AppleScript's text item delimiters to {"<"}
set progname to text item 1 of source2

display dialog "Downloads" & return & return & progname & ": " & downloadcount