Chinaunix首页 | 论坛 | 博客
  • 博客访问: 697394
  • 博文数量: 112
  • 博客积分: 2486
  • 博客等级: 大尉
  • 技术积分: 1541
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-14 18:30
文章分类

全部博文(112)

文章存档

2012年(5)

2011年(48)

2010年(26)

2009年(33)

我的朋友

分类: LINUX

2010-11-30 15:54:00

优酷网站的视频可以设置独立的播放密码,不过你可知道:观看有密码的优酷视频其实不需要密码哦。下面讲述两种方法进行优酷视频密码破解的方法。

  方法一:

  打开FLV解析网站,这里推荐使用该站点:,从浏览器地址栏复制需要解密的优酷视频地址,粘贴视频地 址到FLV解析网站的地址框,点击”开始GO进行解析。得到视频文件的真实下载地址,右键下载地址,选择”目标另存为”即可下载(也可以使用迅雷,快车等 下载工具下载,速度是非常快的)。

  方法二:

  在视频地址youku前面直接添加”xia”(不包括双引号)即可。例如, /id_xntg1mzc4ndq=.html,只需要改为 /id_xntg1mzc4ndq=.html,在浏览器输入即可解析到视频文件真实下载地址。接下来的操作跟方法一的步骤3相同。

方法三:

用perl脚本。perl url可以列表显示该url下的视频的解密后的链接。perl -h可以查看帮助。

#!/usr/bin/perl
####################################
#   Author  loveky                 #
#   MSN     ylzcylx@gmail.com      #
#   QQ      262172239              #
####################################
use warnings;
use strict;
use LWP::Simple;
use LWP::UserAgent;
use Getopt::Std;

my %options;
getopts('hd:', \%options);
&usage_and_exit if defined $options{h};

my $video_url = shift;
my $video_id            = &get_video_id($video_url);
my $PlayList_content    = &getPlayList($video_id);
my @FlvPath             = &build_FlvPath($PlayList_content);

if (defined $options{d}) {
&download($options{d}, @FlvPath);
}
else {
print "The flv file addresses are\n";
print "=" x 70 . "\n";
print join("\n", @FlvPath);
print "\n" . "=" x 70 . "\n";
}

sub get_video_id {
my $url         = shift;
my ($video_id)    = $url =~ m/id_([^\.]+)\./;
return $video_id;
}

sub getPlayList {
my $video_id    = shift;
my $PlayListurl = ""
. $video_id
. "/version/5/source/video?password=&ran=8704&n=3";
return get "$PlayListurl";
}

sub build_FlvPath {
my $PlayList_content = shift;
my ($seed, $key1, $key2, $fileId, $flv_no) = $PlayList_content =~ m/
"seed":(\d+),
.+?key1":"(\w+)","key2":"(\w+)"
.+?"flv":"([0-9\*]+)"},"segs"
.+{"no":"(\d+?)",.+?streamsizes"
/x;
chop($fileId);
my $Sid     = &getSid;
my $realId  = &getFileId($fileId, getMixString($seed));
my $key     = &getKey($key1, $key2);
my @flv_url = map { &get_url_by_no($Sid, $realId, $_, $key);} 0..$flv_no;
return @flv_url;
}

sub get_url_by_no {
my ($Sid, $realId, $flv_no, $key) = @_;
$flv_no = sprintf("%x", $flv_no);
$flv_no = "0" . $flv_no if length($flv_no) < 2;
$flv_no =~ tr/a-z/A-Z/;
$Sid = "00_00";
substr($realId, 8, 2) = "$flv_no";
return  ""
. $Sid
. "/st/flv/fileid/"
. $realId
. "?K="
. $key;
}

sub getSid {
my $rand0 = 100 + int(rand(899));
my $rand1 = 1000 + int(rand(999));
my $rand2 = 1000 + int(rand(9000));
return time . $rand0 . $rand1 . $rand2;
}

sub getFileId {
my ($fileId, $mixed) = @_;
my $realId;
my @ids = split(/\*/, $fileId);
for (my $i = 0; $i < @ids; $i++) {
$realId .= substr($mixed, $ids[$i], 1);
}
return $realId;
}

sub getMixString {
my $seed    = shift;
my $source  = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890";
my $length  = length($source);
my $mixed;
for (my $i = 0; $i < $length; $i++) {
$seed = ($seed * 211 + 30031) % 65536;
my $index   = int($seed / 65536 * length($source));
my $chr     = substr($source, $index, 1);
$mixed     .= $chr;
$source     =~ s/\Q$chr\E//;
}
return $mixed;
}

sub getKey {
my ($key1, $key2) = @_;
my $appendkey = hex($key1);
$appendkey ^= 0xA55AA5A5;
return $key2 . sprintf("%x", $appendkey);
}

sub download {
my $file_prefix = shift;
my @flv_url = @_;
my ($filename, $fileno);
my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
foreach (0..$#flv_url) {
my $fileno   = length($_) > 1 ? $_ : "0" . $_;
my $filename = "$file_prefix" . $fileno . ".flv";
print "Downloading $filename...\n";
$ua->mirror("$flv_url[$_]", "$filename");
}
}

sub usage_and_exit {
print "Usage:$0 [-d FILENAME_PREFIX] Youku_url\n";
print "Decode Youku's video url into its real Flv file path.\n";
print "     -d FILENAME_PREFIX   If you specify -d with a value. $0 will \n";
print "        download the flv files and save as filename like FILENAME_PREFIX_00\n";
print "        instead of just print these flv file pathes\n";
print "     -h print this help message\n";
print "Author:michael.wang\@rdps-china.com\n";
exit 0;
}
阅读(2418) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~