- Add DoubleViking grabber
[videosite.git] / videosite / DailyMotionGrabber.pm
index 8cea83c..b77c119 100644 (file)
@@ -14,7 +14,7 @@ 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);
 
@@ -58,14 +58,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;
+
         }
     }