Welcome 微信登录

首页 / 操作系统 / Linux / 用bash脚本下载ku6网视频

#!/bin/bashfunction crack_ep_html {    declare -a TO=("\u0020"   "\u0021"  "\u0022"  "\u0023"  "\u0024"  "\u0025"  "\u0026"  "\u0027"                   "\u0028"   "\u0029"  "\u002a"  "\u002b"  "\u002c"  "\u002d"  "\u002e"  "\u002f"                    "\u0030"   "\u0031"  "\u0032"  "\u0033"  "\u0034"  "\u0035"  "\u0036"  "\u0037"                    "\u0038"   "\u0039"  "\u003a"  "\u003b"  "\u003c"  "\u003d"  "\u003e"  "\u003f"                     "http"       ".f4v")    declare -a BY=(" "          "!"         """        "#"         "$"         "%"         "&"         """                          "("          ")"         "*"         "+"         ","         "-"         "."        "/"                   "0"          "1"         "2"         "3"         "4"         "5"         "6"         "7"                           "8"          "9"         ":"         ";"         "<"         "="         ">"         "?"                            " http"     ".f4v ")    declare -i I=0    grep "f4v" $EP.html > ${EP}.txt    while [ $I -lt 34 ];do        sed "s/${TO[$I]}/${BY[$I]}/g" $EP.txt > $EP.tmp        cp  $EP.tmp $EP.txt        rm  $EP.tmp        I=I+1    done    grep "http://main.gslb.ku6.com/" $EP.txt > $EP.tmp    cp $EP.tmp $EP.txt    rm $EP.tmp}function download_ep {EPURL=$1EP=$2echo "download_ep $EPURL $EP=========>"wget $EPURL -O ${EP}.htmlcrack_ep_html    declare -i PARTNO=1declare -i PARTCNT=`wc -l $EP.txt | awk "{print $1}"`ALL_PARTS=    while [ $PARTNO -le $PARTCNT ]; do        PARTURL=`sed -n ${PARTNO}p $EP.txt`if [ -z $PARTURL ]; thenbreakfiif [ ! -f $EP.$PARTNO.f4v ]; then       wget $PARTURL -O $EP.$PARTNO.f4vif [ $? != "0" ]; thenrm -f $EP.$PARTNO.f4vfifiif [ -f $EP.$PARTNO.f4v ]; thenALL_PARTS+="$EP.$PARTNO.f4v "fi        PARTNO+=1    done#Join all parts to a single mkv fileif [ ! -f $EP.mkv ]; thenmencoder -oac pcm -ovc copy -of lavf -o $EP.mkv $ALL_PARTSfi}download_ep $1 $2
###########################################参数1为: 酷6网视频所在网址参数2为:视频文件名称例如将脚本存为 get_ku6:./get_ku6 http://v.ku6.com/film/index_124668.html di_renjie