1 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
2 # licensed under GNU GPL v2
4 # Grabber for myvideo.de
6 package videosite::MyVideoGrabber;
8 use videosite::GrabberBase;
9 @ISA = qw(videosite::GrabberBase);
18 my $self = $class->SUPER::new(
20 _SELFTESTURL => 'http://www.myvideo.de/watch/9191174/Battle_Worlds_Kronos_Alpha_Version_ausprobiert',
21 _SELFTESTTITLE => 'Battle Worlds: Kronos - Alpha-Version ausprobiert',
22 PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*myvideo.de/watch/(\d+))'],
26 return bless($self, $class);
41 $metadata->{'URL'} = $url;
42 $metadata->{'ID'} = $2;
43 $metadata->{'TYPE'} = 'video';
44 $metadata->{'SOURCE'} = $self->{'NAME'};
45 $metadata->{'TITLE'} = undef;
46 $metadata->{'DLURL'} = undef;
48 unless(defined($content = $self->simple_get(sprintf('http://www.myvideo.de/watch/%s', $2)))) {
49 $self->error('Could not download %s', $url);
53 $p = HTML::TokeParser->new(\$content);
54 while ($t = $p->get_tag('meta', 'link')) {
55 if ('meta' eq $t->[0]) {
56 if (exists($t->[1]->{property}) and ($t->[1]->{property} eq 'og:title')) {
57 $metadata->{'TITLE'} = $t->[1]->{content};
59 } elsif ('link' eq $t->[0]) {
60 if (exists($t->[1]->{rel}) and ($t->[1]->{rel} eq 'image_src')) {
61 $metadata->{'DLURL'} = $t->[1]->{'href'};
62 $metadata->{'DLURL'} =~ s,thumbs/[^/]*$,,;
63 $metadata->{'DLURL'} .= $metadata->{'ID'} . ".flv";
64 $self->debug("Found URL: %s", $metadata->{'DLURL'});
69 unless(defined($metadata->{'DLURL'}) && defined($metadata->{'TITLE'})) {
70 $self->error('Could not determine download URL');