BlipTV: Fix grabber
[videosite.git] / videosite / Base.pm
index 001ec56..bc38468 100644 (file)
@@ -181,7 +181,11 @@ sub ua {
     my $self = shift;
     my $ua;
 
-    $ua = LWP::UserAgent->new('agent' => 'Mozilla/5.0', 'cookie_jar' => HTTP::Cookies->new);
+    $ua = LWP::UserAgent->new(
+            'agent' => 'Mozilla/5.0',
+            'cookie_jar' => HTTP::Cookies->new,
+            'timeout' => 15,
+            );
 
     # Remove a currently defined HTTPS proxy. See below for a longer explanation.
     delete($ENV{'HTTPS_PROXY'});
@@ -220,6 +224,17 @@ sub ua {
     return $ua;
 }
 
+sub simple_get {
+    my $self = shift;
+    my $url = shift;
+    my $ua = shift || $self->ua();
+    my $r;
+
+    $r = $ua->get($url);
+    return $r->decoded_content() if $r->is_success();
+    return undef;
+}
+
 sub decode_hexurl {
     my $self = shift;
     my $d = shift;