- Check for existance of hash key before using
[videosite.git] / videosite / YouTubeGrabber.pm
index 1a47049..f4bac10 100644 (file)
@@ -81,7 +81,7 @@ sub _parse {
             return undef;
         }
     }
-    $content = $r->decoded_content();
+    $content = $r->content();
 
     $p = HTML::TokeParser->new(\$content);
 
@@ -100,7 +100,7 @@ sub _parse {
                 $self->debug('URL found: %s', $metadata->{'DLURL'});
             }
         } elsif ('div' eq $tag->[0]) {
-            if ('errorBox' eq $tag->[1]->{'class'}) {
+            if (exists($tag->[1]->{'class'}) and ('errorBox' eq $tag->[1]->{'class'})) {
                 $self->error("Could not get video data for youtube %s: %s",
                         $metadata->{'ID'}, $p->get_trimmed_text());
                 return undef;