use GrabberBase;
@ISA = qw(GrabberBase);
+use HTMLHelper;
use LWP::Simple qw(!get);
use XML::Simple;
use Data::Dumper;
my $content;
my $metadata = {};
my $p = XML::Simple->new();
+ my @accum;
my $t;
$url =~ m|$pattern|;
}
$metadata->{'DLURL'} = $t->{'video'}->{'file'};
- $metadata->{'TITLE'} = $t->{'video'}->{'caption'};
+
+ # The XML does not contain the full title of the video, for
+ # reasons possibly known to some jerk at CollegeHumor.
+ # So we'll have to parse the actual HTML, too.
+ $p = HTMLHelper->new();
+ unless(defined($content = $p->load(sprintf('http://www.collegehumor.com/video:%s', $2)))) {
+ $self->error('Could not download HTML');
+ return undef;
+ }
+
+ $t = $p->findnodes('meta[@name="title"]');
+ if (defined($t)) {
+ $metadata->{'TITLE'} = $t->{'content'};
+ }
unless(defined($metadata->{'DLURL'}) && defined($metadata->{'TITLE'})) {
$self->error('Could not extract download URL and title');