SVN: toys/rsget.pl/Video/RedTube
sparky
sparky at pld-linux.org
Tue Oct 6 03:31:39 CEST 2009
Author: sparky
Date: Tue Oct 6 03:31:39 2009
New Revision: 10697
Added:
toys/rsget.pl/Video/RedTube
Log:
- new, response for public demand :-P
Added: toys/rsget.pl/Video/RedTube
==============================================================================
--- (empty file)
+++ toys/rsget.pl/Video/RedTube Tue Oct 6 03:31:39 2009
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+name: RedTube
+short: V:RedTube
+uri: qr{redtube\.com/}
+slots: 8
+status: OK 2009-10-05
+
+start:
+ GET( $-{_uri} );
+
+ ! m{<h1 class="videoTitle">(.*?)</h1>};
+ my $fname = de_ml( $1 );
+ $fname =~ s{/}{_}g;
+ $fname .= ".flv";
+
+ ! m{so\.addParam\("flashvars","(.*?)"};
+ my %o = map /^(.*?)=(.*)$/, split /\&(?:amp;)?/, $1;
+
+ INFO( name => $fname, quality => "$o{width}x$o{height}" );
+
+ my $file_uri = "http://dl.redtube.com/467f9bca32b1989277b48582944f325afa3374/"
+ . id_to_file( $o{id} ) . $o{hash_flv};
+
+ DOWNLOAD( $file_uri, fname => $fname );
+
+perl:
+
+ # simplified version of what may be found in clive
+sub id_to_file
+{
+ my $id = shift;
+ my @id = split //, sprintf '%08d', $id;
+
+ my $hash = 0;
+ $hash += $id[ $_ ] * $_ foreach (1..7);
+
+ my $add = 0;
+ $add += $_ foreach split //, "$hash";
+
+ my @map = unpack( 'C*', 'R15342O7K9HBCDXFGAIJ8LMZ6PQ0STUVWEYN' );
+ my @add = (3, 0, 2, 1, 6, 5, 0, 7, 4);
+ my @d_at = (4, 0, 1, 3, 6, 2, 0, 5, 7);
+ my @chars = map { $map[ $id[ $d_at[ $_ ] ] + $add + $add[ $_ ] ] } (0..8);
+ $chars[ 1 ] = 48 + $add % 10;
+ $chars[ 6 ] = 48 + $add / 10;
+
+ return sprintf( '%07d/%s.flv', $id / 1000, pack( 'C*', @chars ) );
+}
+
+# vim:ts=4:sw=4
More information about the pld-cvs-commit
mailing list