1 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
2 # licensed under GNU GPL v2
4 # Grabber for sevenload.com/de
6 package videosite::SevenloadGrabber;
8 use videosite::GrabberBase;
9 @ISA = qw(videosite::GrabberBase);
19 my $self = $class->SUPER::new(
21 _SELFTESTURL => 'http://www.sevenload.com/videos/twins-one-guitar-5122ed655a1cb35c41003c64',
22 _SELFTESTTITLE => 'Twins one guitar',
23 PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*sevenload\.com/videos/.+-([[:alnum:]]+))'],
27 return bless($self, $class);
42 $metadata->{'URL'} = $url;
43 $metadata->{'ID'} = $2;
44 $metadata->{'TYPE'} = 'video';
45 $metadata->{'SOURCE'} = $self->{'NAME'};
46 $metadata->{'TITLE'} = undef;
47 $metadata->{'DLURL'} = undef;
49 # Get the HTML page for the title
50 unless(defined($content = $self->simple_get($url))) {
51 $self->error('Could not download HTM');
55 $p = HTML::TokeParser->new(\$content);
56 while ($t = $p->get_tag('meta')) {
57 if ('meta' eq $t->[0]) {
58 if (exists($t->[1]->{'property'}) and ($t->[1]->{'property'} eq 'og:title')) {
59 $metadata->{'TITLE'} = $t->[1]->{'content'};
64 # Get the XML file containing the video metadata
65 unless(defined($content = $self->simple_get(sprintf('http://player-services.sevenload.com/p/1/sp/1/playManifest/entryId/%s', $2)))) {
66 $self->error('Could not download XML metadata');
70 $p = XML::Simple->new();
71 unless(defined($t = $p->XMLin($content, KeepRoot => 1))) {
72 $self->error('Could not parse XML metadata');
76 # Loop through the video streams
77 $metadata->{'DLURL'} = $t->{'manifest'}->{'media'}->{'url'};
79 unless(defined($metadata->{'DLURL'}) && defined($metadata->{'TITLE'})) {
80 $self->error('Could not extract download URL and title');