#! /usr/bin/perl -w
#! /usr/bin/curl
# Autofetch reviews
# ToDo
#print "To Do Reviews:\n";
$currentSoftware = 321234472;
getAllReviewstest();
sub getAllReviewstest()
{
$country="\nCOUNTRY: United States";
$store = 143441;
#print $country, "\n";
fetchReviews();
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Reviews</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "$review\n";
print "</BODY>\n";
print "</HTML>\n";
}
sub getAllReviews()
{
$country="\nCOUNTRY: United States";
$store = 143441;
print $country, "\n";
fetchReviews();
}
sub fetchReviews()
{
# my $doit = qq{curl -s -A "iTunes/4.2 (Macintosh; U; PPC Mac OS X 10.2" -H "X-Apple-Store-Front: $store-1" 'http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=$currentSoftware&mt=8' | gunzip | xmllint --format -};
my $doit = qq{curl -s 'http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=$currentSoftware&mt=8'};
my $riz = `$doit`;
my @rizray = split('\n', $riz);
my @rizray = grep(!/string/, @rizray);
my @rizray = grep(!/key/, @rizray);
my @rizray = grep(!/dict/, @rizray);
my @rizray = grep(!/VBoxView/, @rizray);
my @rizray = grep(!/HBoxView/, @rizray);
my @rizray = grep(!/MatrixView/, @rizray);
my @rizray = grep(!/TextView/, @rizray);
my @rizray = grep(!/iTunes/, @rizray);
my @rizray = grep(!/LoadFrameURL/, @rizray);
my @rizray = grep(!/PathElement/, @rizray);
my @rizray = grep(!/Protocol/, @rizray);
my @rizray = grep(!/ScrollView/, @rizray);
my @rizray = grep(!/Category.*/, @rizray);
my @rizray = grep(!/Color/, @rizray);
my @rizray = grep(!/Released.*/, @rizray);
my @rizray = grep(!/Seller.*/, @rizray);
my @rizray = grep(!/Rated.*/, @rizray);
my @rizray = grep(!/Rate this.*/, @rizray);
my @rizray = grep(!/©.*/, @rizray);
my @rizray = grep(!/.*MB/, @rizray);
my @rizray = grep(!/Version.*/, @rizray);
my @rizray = grep(!/.*2009/, @rizray);
my @rizray = grep(!/Infrequent.*/, @rizray);
my @rizray = grep(!/NEW.*/, @rizray);
my @rizray = grep(!/LANGUAGES.*/, @rizray);
my @rizray = grep(!/REQUIREMENTS.*/, @rizray);
my @rizray = grep(!/Apple.*/, @rizray);
my @rizray = grep(!/All rights.*/, @rizray);
my @rizray = grep(!/Policy.*/, @rizray);
my @rizray = grep(!/Terms of.*/, @rizray);
my @rizray = grep(!/Compatible.*/, @rizray);
my @rizray = grep(!/Requires.*/, @rizray);
my @rizray = grep(!/English.*/, @rizray);
my @rizray = grep(!/<b>.*/, @rizray);
my @rizray = grep(!/normalStyle/, @rizray);
my @rizray = grep(!/GotoURL/, @rizray);
my @rizray = grep(!/Sort by:/, @rizray);
my @rizray = grep(!/by.*/, @rizray);
#my @rizray = grep(!/">$/, @rizray);
my @rizray = grep(!/Copyright/, @rizray);
my @rizray = grep(!/> \/</, @rizray);
my @rizray = grep(!/>..</, @rizray);
foreach my $item (@rizray)
{
# print $item, ": ";
#$item =~ s/.*">//;
#$item =~ s/<.*//;
$review = "$review$item";
}
}