X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=quotesite.git;a=blobdiff_plain;f=quotesite%2FGermanBashGrabber.pm;h=747968cb07a9fb4df7a2c91d5b4b9addd7025fee;hp=919f015b7f145fceba906cee016c3f1de1d9962e;hb=18eb17221c111a8442538c54d2527e8c06b25803;hpb=134915427cbf80a82868b173766a9c0da84b0fba diff --git a/quotesite/GermanBashGrabber.pm b/quotesite/GermanBashGrabber.pm index 919f015..747968c 100644 --- a/quotesite/GermanBashGrabber.pm +++ b/quotesite/GermanBashGrabber.pm @@ -3,12 +3,12 @@ # # Grabber for german-bash.org -package GermanBashGrabber; +package quotesite::GermanBashGrabber; -use GrabberBase; -@ISA = qw(GrabberBase); +use quotesite::GrabberBase; +@ISA = qw(quotesite::GrabberBase); -use LWP::Simple qw(!get); +use LWP::UserAgent; use HTML::TokeParser; use Data::Dumper; @@ -36,6 +36,7 @@ sub _parse { my $metadata = {}; my $p; my $t; + my $ua = LWP::UserAgent->new('agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'); $url =~ m|$pattern|; $url = $1; @@ -47,10 +48,12 @@ sub _parse { $metadata->{'CONTENT'} = undef; # Get the HTML file containing the quote - unless(defined($content = LWP::Simple::get(sprintf('http://german-bash.org/%s', $2)))) { + $content = $ua->get(sprintf('http://german-bash.org/%s', $2)); + unless($content->is_success) { $self->error('Could not download quote'); return undef; } + $content = $content->decoded_content(); $p = HTML::TokeParser->new(\$content);