fix quoting in AsyncWgetFileGetter again
[videosite.git] / videosite / CollegeHumorGrabber.pm
index 546e669..c7851e3 100644 (file)
@@ -3,12 +3,12 @@
 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
 # licensed under GNU GPL v2
 
-package CollegeHumorGrabber;
+package videosite::CollegeHumorGrabber;
 
-use GrabberBase;
-@ISA = qw(GrabberBase);
+use videosite::GrabberBase;
+@ISA = qw(videosite::GrabberBase);
 
-use LWP::Simple qw(!get);
+use videosite::HTMLHelper;
 use XML::Simple;
 use Data::Dumper;
 
@@ -16,15 +16,16 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'collegehumor';
-    $self->{'PATTERNS'} = ['(http://www.collegehumor.com/video:(\d+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'collegehumor',
+        _SELFTESTURL => 'http://www.collegehumor.com/video/5635400/pixar-intro-parody',
+        _SELFTESTTITLE => 'Pixar Intro Parody',
+        PATTERNS => ['(http://www.collegehumor.com/video:(\d+))',
+                     '(http://www.collegehumor.com/video/(\d+))'],
+        @_,
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
@@ -34,6 +35,7 @@ sub _parse {
     my $content;
     my $metadata = {};
     my $p = XML::Simple->new();
+    my @accum;
     my $t;
 
     $url =~ m|$pattern|;
@@ -47,7 +49,7 @@ sub _parse {
     $metadata->{'DLURL'} = undef;
 
     # Get the XML file containing the video metadata
-    unless(defined($content = LWP::Simple::get(sprintf('http://www.collegehumor.com/moogaloop/video:%s', $2)))) {
+    unless(defined($content = $self->simple_get(sprintf('http://www.collegehumor.com/moogaloop/video/%s', $2)))) {
         $self->error('Could not download XML metadata');
         return undef;
     }