Board logo

标题: 9flash所有swf任我下(支持断点续传) v1.0.bat [打印本页]

作者: vkill     时间: 2007-1-15 06:04    标题: 9flash所有swf任我下(支持断点续传) v1.0.bat

wget + sed 写成,使用前先阅读readme.txt

[ Last edited by vkill on 2007-10-22 at 08:48 PM ]
作者: vkill     时间: 2007-1-15 06:05
更新下载地址.bat
@echo off
title 9flash *.swf任我下----更新

set "url=http://www.9flash.com/"
set "music=FlashDefault/1.html"
set "movie=FlashDefault/2.html"
set "game=FlashDefault/3.html"
set "t=test.tx"
::分类页面里面的共n页,越大越慢,1~100中间都可以
set "top=50"

copy /y swfs.txt swfs.back>nul 2>nul
cd.>swfs.txt
md "%t%">nul 2>nul
PUSHD "%t%"
del /a/s/f/q *.html *.txt>nul 2>nul
title [1/3]更新分类列表
cls
echo 请稍候......
wget -q -O 1.html "%url%%music%"
wget -q -O 2.html "%url%%movie%"
wget -q -O 3.html "%url%%game%"
sed "/作品分类/,/[ ]*<\/ul>/!d;{/作品分类/{s/<[^>]*>//g;s/[ \t]*//g;s/^/\[/;s/$/\]/};s/[^/]*\x22\(\/.*\)\x22>\([^<>]*\)<\/a.*/\1→\2/;/^\/\|^\[/!d}" *.html|more>分类.txt

title [2/3]更新分类的作品列表
cls
echo 这一步有点慢,请耐心等待
echo.
for /f "tokens=1,2 delims=→" %%a in (分类.txt) do (
del /a/s/f/q *.html>nul 2>nul
echo %%a|findstr /B "[">nul && (>>htmls.txt echo %%a) ||(
echo 正在更新分类 %%b 的作品列表
>>htmls.txt echo #%%b
for /l %%? in (1,1,%top%) do (wget -q -O %%?.html "%url%%%a&PageIndex=%%?")
sed "/作品列表/,/[ ]*第[0-9]*页共[0-9]*页/!d;{/.html/!d;/http:/d;{s/[^/]*\x22\(\/.*\)\x22>\([^<>]*\)<\/a.*/\1→\2/};/^\//!d}" *.html |more>temp.txt
sed -n 1,$p temp.txt>>htmls.txt
)
)

title [3/3]更新作品的下载地址
cls
for /f "tokens=1,2 delims=→" %%a in ('sed "s:/FlashPlay/:/Flash/:" htmls.txt') do (
echo %%a|findstr /B "^/">nul && (
echo 正在更新作品 %%b 的下载地址
wget -q -O temp.html "%url%%%a"
sed "/\([0-9a-zA-Z]\{32\}\).swf/!d;{s/.*\(http:.*[0-9a-zA-Z]\{32\}.swf\).*/\1/}" temp.html|more>temp.txt
for /f "tokens=*" %%? in ('sed -n 1p temp.txt') do (>>../swfs.txt echo %%?→%%b)
)||(>>../swfs.txt echo %%a)
)

title 更新完毕
echo.
echo 旧的列表文件 swfs.txt 备份成为 swfs.back
echo.
echo 请查看新列表文件swfs.txt是否正确,如不正确请立即恢复
pause>nul
goto :eof
下载.bat
@echo off
title 9flash *.swf任我下(支持断点续传)      by:vkill      V:1.0
if not exist swfs.txt (echo 缺少文件swfs.txt&pause>nul&goto :eof)
findstr . swfs.txt>nul ||(echo swfs.txt是空的&pause>nul&goto :eof)
set "t=test.tx"
:xuanze
cls
echo.
echo                 请输入你要下载的flash文件名,全部下载输入all
echo.
set name=
set/p name=                        name=
if "%name%*"=="*" goto xuanze
if "%name%*"=="all*" goto down_all
md "%t%">nul 2>nul
PUSHD "%t%"
del /a/s/f/q *.txt>nul 2>nul
sed "/→.*%name%/!d" ../swfs.txt|more>temp.txt
echo.
findstr . temp.txt>nul ||(echo 没有找到你要搜索的flash&pause>nul&goto xuanze)
cls
echo ________________________________________________________________________________
echo                   你要搜索的flash作品列表如下,5秒后开始自动下载
type temp.txt
echo ________________________________________________________________________________
ping -n 10 127.1>nul 2>nul
popd
for /f "tokens=1,2 delims=→" %%a in (temp.txt) do (
echo 正在下载作品%%b
wget -q -c -O %%b.swf "%%a"
)
goto end

:down_all
cls
for /f "tokens=1,2 delims=→" %%a in (swfs.txt) do (
echo %%a|findstr /B "[">nul && (
cd.>nul
) ||(echo %%a|findstr /B "#">nul && (
popd
md "%%a">nul 2>nul
PUSHD %%a
) ||(
echo 正在下载作品%%b
wget -q -c -O "%%b.swf" "%%a"
)
)
)
goto end

:end
echo 你所需求的flash作品全部下载完毕
pause>nul
goto :eof
[ Last edited by vkill on 2007-1-15 at 06:06 AM ]
作者: vkill     时间: 2007-1-15 06:07
用下,看可以不,我在网吧弄了可以的
作者: xyq3312     时间: 2007-8-20 04:42
来的晚点,对不错的东东还是要顶的
作者: qq43142691     时间: 2007-8-20 07:39
一闪而过..
作者: dunniu     时间: 2007-10-21 17:49
这个厉害