Replace use of LWP::Simple in all grabbers by $self->simple_get()
[videosite.git] / videosite / BlipTVGrabber.pm
index 5a53d2c..86bbffd 100644 (file)
@@ -8,8 +8,6 @@ package videosite::BlipTVGrabber;
 use videosite::GrabberBase;
 @ISA = qw(videosite::GrabberBase);
 
-use LWP::Simple qw(!get);
-use LWP::UserAgent;
 use URI;
 use URI::QueryParam;
 use HTML::Parser;
@@ -43,7 +41,7 @@ sub _parse {
     my @text;
     my $e;
     my $xml = undef;
-    my $ua;
+    my $ua = $self->ua();
 
     $url =~ m|$pattern|;
     $url = $1;
@@ -57,7 +55,7 @@ sub _parse {
 
     if ($pattern eq $self->{'PATTERNS'}->[0]) {
         # blip.tv/file pattern
-        unless(defined($content = LWP::Simple::get(sprintf('http://blip.tv/file/%s', $2)))) {
+        unless(defined($content = $self->simple_get(sprintf('http://blip.tv/file/%s', $2), $ua))) {
             $self->error('Could not download page');
             return undef;
         }
@@ -78,7 +76,7 @@ sub _parse {
         my $r;
         my $u;
 
-        $ua = LWP::UserAgent->new(max_redirect => 0);
+        $ua->max_redirect(0);
         $r = $ua->get(sprintf('http://blip.tv/play/%s', $2));
 
         unless(defined($r)) {
@@ -110,7 +108,8 @@ sub _parse {
     }
 
     # Download the XML file containing the stream information
-    unless(defined($content = LWP::Simple::get(sprintf('http://blip.tv/rss/flash/%s', $xml)))) {
+    $ua->max_redirect(7);
+    unless(defined($content = $self->simple_get(sprintf('http://blip.tv/rss/flash/%s', $xml), $ua))) {
         $self->error('Could not download XML metadata');
         return undef;
     }