1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/perl -w use strict; use warnings; use HTML::TreeBuilder::XPath; use LWP::UserAgent; my $url = 'www.example.de'; my $ua = LWP::UserAgent->new; my $response = $ua->get($url); if (not $response->is_success) { die "Error fetching url $url\n $response->status_line \n"; } my $tree= HTML::TreeBuilder::XPath->new; $tree->parse($response->decoded_content); my $rezensionen = $tree->findvalue( '//div[@class="crIFrameHeaderHistogram"]/div[@class="tiny"]/b'); print $rezensionen; my $sterne = $tree->findvalue( '//div[@class="crIFrameNumCustReviews"]/span/span/a/img/@alt'); print $sterne; $tree->delete;