X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=videosite%2FDailyMotionGrabber.pm;h=24afc7d29c094c8e13eb2d852f6b7a40f30b0f3a;hb=04ab1c3a6f2107d94804fc7c99ecce659d1ee1b8;hp=286c8769a121411ea2fd6384be2106fb13a738b4;hpb=030f66b1d4e02e927dd8767e5d10d399acff730e;p=videosite.git diff --git a/videosite/DailyMotionGrabber.pm b/videosite/DailyMotionGrabber.pm index 286c876..24afc7d 100644 --- a/videosite/DailyMotionGrabber.pm +++ b/videosite/DailyMotionGrabber.pm @@ -1,3 +1,8 @@ +# Grabber for dailymotion.com +# +# (c) 2007 by Ralf Ertzinger +# licensed under GNU GPL v2 + package DailyMotionGrabber; use GrabberBase; @@ -14,10 +19,12 @@ sub new { my $self = $class->SUPER::new(); $self->{'NAME'} = 'dailymotion'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*.dailymotion.com/(?:[^/]+/)*video/([-a-zA-Z0-9_]+))']; + $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*dailymotion.com/(?:[^/]+/)*video/([-a-zA-Z0-9_]+))']; bless($self, $class); + $self->_prepare_parameters(); + return $self; } @@ -38,7 +45,7 @@ sub _parse { $metadata->{'URL'} = $url; $metadata->{'ID'} = $2; $metadata->{'TYPE'} = 'video'; - $metadata->{'SOURCE'} = 'dailymotion'; + $metadata->{'SOURCE'} = $self->{'NAME'}; $metadata->{'TITLE'} = undef; $metadata->{'DLURL'} = undef; @@ -58,14 +65,17 @@ sub _parse { if ('meta' eq $e->[0]) { if ('title' eq $e->[1]->{'name'}) { $metadata->{'TITLE'} = $e->[1]->{'content'}; + $metadata->{'TITLE'} =~ s/^Dailymotion\s*:\s*//; } } } # Look for the download URL foreach $e (@text) { - if ($e->[0] =~ m|\.add_variable("url", "([^\"]+)")|) { + if ($e->[0] =~ m|\.addVariable\("url", "([^\"]+)"|) { $metadata->{'DLURL'} = $1; + $metadata->{'DLURL'} =~ s/%(..)/chr(hex($1))/ge; + } }