Thread <b>*</b> mit perl aus XML filtern? (64 answers)
Opened by Hunnenkoenig at 2009-10-27 18:57

Gast Hunnenkoenig
 2009-10-27 19:20
#127363 #127363
Danke!

Ich verstehe nicht viel davon leider :-)
Vielleicht am besten poste ich hier den ganzen kode.

ich will eigentlich aus dem appstore die app beschreibungen rausholen und habe daher einen perl script vom internet als beispiel genommen. Der original script liest eigentlich die reviews aus.

der link zum XML ist das:
http://ax.itunes.apple.com/WebObjects/MZStore.woa/...

Der script, wie es bis jetzt funktioniert ist hier:
http://promodispenser.com/cgi-bin/appinfo.pl

Wenn jemand mir einen besseren schreiben könnte, wäre ich super dankbar dafür.

Der kode selber:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#! /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";
}
}

View full thread <b>*</b> mit perl aus XML filtern?