[SCM] Video extraction utility for YouTube, Google Video and other video sites (Debian packaging) branch, master, updated. upstream/2.1.7-214-g6762190

legatvs legatvs at gmail.com
Wed Apr 1 14:45:10 UTC 2009


The following commit has been merged in the master branch:
commit 415580e11b1a98448f1b430d147f1ed3b63d7c86
Author: legatvs <legatvs at gmail.com>
Date:   Wed Mar 18 04:01:22 2009 +0200

    Port dailymotion support from cclive.

diff --git a/clive b/clive
index 0849fa4..9389e56 100755
--- a/clive
+++ b/clive
@@ -87,6 +87,7 @@ my %re_hosts = (    # Precompiled regex used to identify the host
     IsLastfm    => qr|last.fm|i,
     IsLiveleak  => qr|liveleak.com|i,
     IsEvisor    => qr|evisor.tv|i,
+    IsDmotion   => qr|dailymotion.com|i,
 );
 
 # Parse config
@@ -320,6 +321,8 @@ sub process_page {
         ($xurl, $id) = handle_liveleak($response_ref, $response_fh);
     } elsif ( $url =~ /$re_hosts{IsEvisor}/ ) {
         ($xurl, $id) = handle_evisor($response_ref);
+    } elsif ($url =~ /$re_hosts{IsDmotion}/) {
+        ($xurl, $id) = handle_dmotion($response_ref);
     }
     return -1
         if !$xurl or !$id or !$title;
@@ -814,6 +817,46 @@ sub handle_evisor {
     return ($xurl, $id);
 }
 
+sub handle_dmotion {
+    my $resp = shift;
+    my %re = (
+        GrabID => qr|/swf/(.*?)\?|,
+        GrabPaths => qr|"video", "(.*?)"|
+    );
+
+    my ($id, at paths);
+    $id     = $1
+        if $$resp =~ /$re{GrabID}/;
+    my $paths = uri_unescape($1)
+        if $$resp =~ /$re{GrabPaths}/;
+
+    use constant ADDR => "http://dailymotion.com";
+
+    my $xurl;
+    if ($id && $paths) {
+        foreach (split(/\|\|/,$paths)) {
+            my ($path,$type) = split(/@@/,$_);
+            if ($type eq "spark") { # same as regular flv
+                $xurl = ADDR.$path;
+            }
+            if ($type eq $opts{format}) {
+                $xurl = ADDR.$path;
+                last;
+            }
+        }
+    }
+
+    my $errmsg;
+    $errmsg = "id not found"             if !$id;
+    $errmsg = "paths not found"          if !$paths && !$errmsg;
+    $errmsg = "failed to construct xurl" if !$xurl  && !$errmsg;
+
+    print STDERR "\nerror: $errmsg\n"
+        if $errmsg;
+
+    return ($xurl,$id);
+}
+
 
 # Subroutines: Progress
 # NOTE: the 'dot' progress copies much from wget.
@@ -1335,7 +1378,7 @@ sub fetch_sevenload_configxml {
 sub title_to_filename {
     my $title = shift;
 
-    $title =~ s/(youtube|video|liveleak.com|sevenload)//gi;
+    $title =~ s/(youtube|video|liveleak.com|sevenload|dailymotion)//gi;
     $title =~ s/^\s+//;
     $title =~ s/\s+$//;
 

-- 
Video extraction utility for YouTube, Google Video and other video sites (Debian packaging)



More information about the Pkg-perl-cvs-commits mailing list