flash-down.pl

sh/bash/dash/ksh/zsh等Shell脚本
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

flash-down.pl

#1

帖子 eexpress » 2010-05-22 18:45

flash-down.pdf
(281.58 KiB) 已下载 414 次


今天改了点,去掉了wget。https://github.com/eexpress/eexp-bin/bl ... sh-down.pl
● 鸣学
头像
ChenFengyuan
帖子: 770
注册时间: 2008-03-23 0:39

Re: flash-down.pl

#2

帖子 ChenFengyuan » 2010-05-23 7:33

:em70
头像
ghostry
帖子: 1532
注册时间: 2008-07-23 20:08
来自: http://www.ghostry.cn
联系:

Re: flash-down.pl

#4

帖子 ghostry » 2010-06-07 16:41

:em04 神头换啦。
http://www.ghostry.cn狂网技术工作室,组网建站,平面设计,java项目,空间域名.
好心人点这里进去注册并且用一次,给我增加点流量http://tinyurl.com/272ncjl
电脑配置:
公司:880G/II250/1TB/2G1333/
家:785G+/II245+/1TB/2G677/
头像
It's not me
帖子: 748
注册时间: 2009-12-02 12:41

Re: flash-down.pl

#5

帖子 It's not me » 2010-06-07 16:41

ChenFengyuan 写了::em70
who am I? I wander ...
头像
trigger
帖子: 1604
注册时间: 2006-10-25 18:08

Re: flash-down.pl

#6

帖子 trigger » 2010-06-07 16:45

看着像韩国呢吒
楼主真是一派胡言,真可谓:“两个黄鹂鸣翠柳,不知所云;一行白鹭上青天,不知所止“。本来不想和你辩论,今天气愤不过,和你理论一番。我国宪法写得清清楚楚:“一夜夫妻百日恩,七楼以上才有电梯”。这个想必你知道,既然知道,你就不能断章取义,就算是天气预报,它还有不准的时候呢!!!再者说了,那中国银行也不是你一家开的。人家马拉多纳都结婚了,你还拿着粮票顶什么用呢。真是滑天下之大稽。前些日子,全国人大刚刚开过会,郑重声明:“中国不搞多party制,存栏母猪给补贴”。多好的事呢,楞让你这号人给搅混了。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: flash-down.pl

#7

帖子 eexpress » 2010-07-08 13:02

代码: 全选

● 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);
}
#======================
● 鸣学
头像
thomasxie
帖子: 317
注册时间: 2009-11-22 15:29
联系:

Re: flash-down.pl

#8

帖子 thomasxie » 2010-10-14 12:39

:em11
时间就像一张网,你撒在那里,你的收获就在那里。
头像
fanhe
帖子: 2357
注册时间: 2007-03-24 23:45

Re: flash-down.pl

#9

帖子 fanhe » 2010-10-15 1:18

perl ...
头像
ChenFengyuan
帖子: 770
注册时间: 2008-03-23 0:39

Re: flash-down.pl

#10

帖子 ChenFengyuan » 2010-10-15 20:18

fanhe 写了:perl ...
perl!!!
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: flash-down.pl

#11

帖子 eexpress » 2010-11-21 18:49

$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 '..';

增加根据环境变量,自动压片。
明天找出老脚步,刷网页,批量下算了。
● 鸣学
头像
ChenFengyuan
帖子: 770
注册时间: 2008-03-23 0:39

Re: flash-down.pl

#12

帖子 ChenFengyuan » 2010-11-27 18:37

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
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: flash-down.pl

#13

帖子 eexpress » 2011-11-01 16:27

今天

● 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 $_`;}'
● 鸣学
头像
nmsfan
帖子: 18958
注册时间: 2009-10-16 22:46
来自: finland

Re: flash-down.pl

#14

帖子 nmsfan » 2011-11-01 16:54

批量……EE要把youku端了啊 :em06 :em06
>>>>推Ubuntu 桌面培训~~<<<<
>>>>想加入/了解gimp汉化吗,点我吧~<<<<
——————————————————————
不推荐wubi,也不推荐你给别人推荐wubi…………
随心而为的感觉真好……
强推mayhem!!
强推ensiferum
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: flash-down.pl

#15

帖子 eexpress » 2011-11-17 20:57

该死的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 $_`;}'
● 鸣学
回复