分页: 1 / 3

flash-down.pl

发表于 : 2010-05-22 18:45
eexpress
flash-down.pdf
(281.58 KiB) 已下载 420 次


今天改了点,去掉了wget。https://github.com/eexpress/eexp-bin/bl ... sh-down.pl

Re: flash-down.pl

发表于 : 2010-05-23 7:33
ChenFengyuan
:em70

Re: flash-down.pl

发表于 : 2010-05-24 22:34
595577126
神发帖 膜拜

Re: flash-down.pl

发表于 : 2010-06-07 16:41
ghostry
:em04 神头换啦。

Re: flash-down.pl

发表于 : 2010-06-07 16:41
It's not me
ChenFengyuan 写了::em70

Re: flash-down.pl

发表于 : 2010-06-07 16:45
trigger
看着像韩国呢吒

Re: flash-down.pl

发表于 : 2010-07-08 13:02
eexpress

代码: 全选

● cat bin/flash-down.pl 
#!/usr/bin/perl -w

use utf8;
use strict;
use WWW::Mechanize;
use Net::DBus;

my $dir="$ENV{HOME}/下载/视频下载";
-d $dir && chdir $dir;

$_=$ARGV[0];
s/^http:\/([a-z0-9])/http:\/\/$1/;
chomp; s/\//%2F/g; s/:/%3A/g;
$_="http://www.flvcd.com/parse.php?flag=&format=high&kw=$_&sbt=%BF%AA%CA%BCGO%21";

my $bus = Net::DBus->session->get_service('org.freedesktop.Notifications')->get_object('/org/freedesktop/Notifications','org.freedesktop.Notifications');
my $mech = WWW::Mechanize->new(agent=>'Opera/9.80 (X11; Linux i686; U; en) Presto/2.6.30 Version/10.60');
#my $mech = WWW::Mechanize->new();
$mech -> get($_);
if ($mech->success()) {
        $_=$mech->content();
        if(/当前解析视频.*/){
        $_=$&; s/^.*?strong>//; s/<strong.*//;
        print "\e[31m\e[1m".$_."\e[0m==================\n";
        s/ .*//; 
        mkdir "$_"; chdir "$_";
        my $name="$_";
        my @link=$mech->find_all_links(text_regex => qr/http:\/\/.*[0-9a-fA-F]*/,);
        my $size=@link;
        $bus->Notify("flash", 0, "sunny", "$name", "共获取 $size 个地址。", [], { }, -1);
#        `xtermcontrol --title "flash-down.pl_下载_$name"`;
        print "\e]2;flash-down.pl_下载_$name\a";
        print map "=> \e[32m".$_->url()."\e[0m\n",@link;
        open(LINK,">link.log"); print LINK map $_->url()."\n",@link; close LINK;
        my $cnt=1; my $proc="▭"x$size;
        foreach(@link){
                my $add=$_->url();
                print "\e[31m下载\e[0m => \e[32m$add\e[0m\n";
                my $file=sprintf "%02d.flv",$cnt;
                `wget -c --tries=5 --user-agent='Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3' "$add" -O $file`;
#                `wget -c --user-agent='Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3' $add -O $file 2>/dev/null`;
                $_=$?==0?"■":"□";$proc=~s/▭/$_/; 
#                $bus->Notify("flash", 0, ($?==0?"sunny":"error"), "$name", "已经完成下载 $cnt / $size ,wget返回:$? 。\n进度:$proc", [], { }, -1);
                print "\e[31m\e[1m$name 已经完成下载 $cnt / $size\e[0m ,wget返回:$? 。进度:\e[31m\e[1m$proc\e[0m\n";
                print "\e]2;$name 下载进度 $proc\a";
                $cnt++;
        }
        chdir '..';
        `echo "$ARGV[0]\t《$_》\t结果:$proc">>flash-down.log`;
        `aplay '/home/exp/媒体/事件声音-et/I-need-ammo.wav'`;
        } else {
        /提示:.*/; $_=$&; s/<br\/>.*$//; 
        $bus->Notify("flash", 0, "error", "flash 解析失败", "$_\n:(", [], { }, -1);
        }
} else {
        $bus->Notify("flash", 0, "gtk-cancel", '网页无效', ':(', [], { }, -1);
}
#======================

Re: flash-down.pl

发表于 : 2010-10-14 12:39
thomasxie
:em11

Re: flash-down.pl

发表于 : 2010-10-15 1:18
fanhe
perl ...

Re: flash-down.pl

发表于 : 2010-10-15 20:18
ChenFengyuan
fanhe 写了:perl ...
perl!!!

Re: flash-down.pl

发表于 : 2010-11-21 18:49
eexpress
$cnt++;
}
#---------------------
# if($ENV{flv2avi}){}
`play "$ENV{HOME}/bin/resources/sound/kongas.ogg"`;
$name=~s/ /-/g;
print "\e]2;$name $(AJ9SC(Bmencoder$(AQ9KuVP!#!#!#(B\a";
$bus->Notify("flash", 0, "sunny", "flash $(AJSF5W*;;3I(B avi", "$dir/$name.avi", [], { }, -1);
`/usr/bin/mencoder -profile c430 *.flv -o $dir/$name.avi 2>&1`;

#---------------------
chdir '..';

增加根据环境变量,自动压片。
明天找出老脚步,刷网页,批量下算了。

Re: flash-down.pl

发表于 : 2010-11-27 18:37
ChenFengyuan
eexpress 写了:$cnt++;
}
#---------------------
# if($ENV{flv2avi}){}
`play "$ENV{HOME}/bin/resources/sound/kongas.ogg"`;
$name=~s/ /-/g;
print "\e]2;$name $(AJ9SC(Bmencoder$(AQ9KuVP!#!#!#(B\a";
$bus->Notify("flash", 0, "sunny", "flash $(AJSF5W*;;3I(B avi", "$dir/$name.avi", [], { }, -1);
`/usr/bin/mencoder -profile c430 *.flv -o $dir/$name.avi 2>&1`;

#---------------------
chdir '..';

增加根据环境变量,自动压片。
明天找出老脚步,刷网页,批量下算了。
脚本要重写了....结构化下.... 现在都挤在一起了,顺便加个判断dbus的,:em04

Re: flash-down.pl

发表于 : 2011-11-01 16:27
eexpress
今天

● fetch-link.pl http://v.youku.com/v_show/id_XMTMzMDIwMTEy.html|grep -o 'http.*[0-9]\{2\}集'|cut -f 1|perl -e 'while(<>){`flash-down.pl $_`;}'

Re: flash-down.pl

发表于 : 2011-11-01 16:54
nmsfan
批量……EE要把youku端了啊 :em06 :em06

Re: flash-down.pl

发表于 : 2011-11-17 20:57
eexpress
该死的vod

下载 => http://data.vod.itc.cn/tv/20110517/2446 ... AW8SP2.mp4

HTTP/1.1 601 Internal Server Error
Server: Resin/3.0.25
Content-Length: 0
Connection: close
Date: Thu, 17 Nov 2011 12:56:08 GMT

不玩了。下质量差点的算了。

● fetch-link.pl http://v.youku.com/v_show/id_XMjk0MTkzNjUy.html |grep -o 'http.*->[0-9]\{3\}'|cut -f 1|perl -e 'while(<>){`flash-down.pl $_`;}'