use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::Parser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://www.myvideo.de/watch/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.myvideo.de/watch/%s', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
$p->handler(start => \@accum, "tagname, attr");
- $p->handler(text => \@text, "text");
- $p->report_tags(qw(meta script));
+ $p->report_tags(qw(meta link));
$p->utf8_mode(1);
$p->parse($content);
if ('meta' eq $e->[0]) {
if ('title' eq $e->[1]->{'name'}) {
$metadata->{'TITLE'} = $e->[1]->{'content'};
- $metadata->{'TITLE'} =~ s/\s*-\s*MyVideo$//;
+ $metadata->{'TITLE'} =~ s/\s+Video\s+-\s+\S+\s+-\s+MyVideo$//;
+ $self->debug("Found title: %s", $metadata->{'TITLE'});
+ last;
}
}
}
# Look for the download URL
- foreach $e (@text) {
- if ($e->[0] =~ m|SWFObject\(.*?\.swf\?([^\&]+)\&|) {
- $metadata->{'DLURL'} = $1;
+ foreach $e (@accum) {
+ if ('link' eq $e->[0]) {
+ if (exists($e->[1]->{'rel'}) and ('image_src' eq $e->[1]->{'rel'})) {
+ $metadata->{'DLURL'} = $e->[1]->{'href'};
+ $metadata->{'DLURL'} =~ s,thumbs/[^/]*$,,;
+ $metadata->{'DLURL'} .= $metadata->{'ID'} . ".flv";
+ $self->debug("Found URL: %s", $metadata->{'DLURL'});
+ last;
+ }
}
}