wget + sed written, read readme.txt before use
[ Last edited by vkill on 2007-10-22 at 08:48 PM ]
[ Last edited by vkill on 2007-10-22 at 08:48 PM ]
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
title 9flash *.swf Let Me Download----Update
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"
::There are a total of n pages in the category page, the larger the slower, can be between 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 Update category list
cls
echo Please wait......
wget -q -O 1.html "%url%%music%"
wget -q -O 2.html "%url%%movie%"
wget -q -O 3.html "%url%%game%"
sed "/Work Category/,/*<\/ul>/!d;{/Work Category/{s/<*>//g;s/*//g;s/^/\/};s/*\x22\(\/.*\)\x22>\(*\)<\/a.*/\1→\2/;/^\/\|^\
Update work list of category
cls
echo This step is a bit slow, please be patient
echo.
for /f "tokens=1,2 delims=→" %%a in (category.txt) do (
del /a/s/f/q *.html>nul 2>nul
echo %%a|findstr /B "
*Page * of * pages/!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 Update download address of work
cls
for /f "tokens=1,2 delims=→" %%a in ('sed "s:/FlashPlay/:/Flash/:" htmls.txt') do (
echo %%a|findstr /B "^/">nul && (
echo Updating download address of work %%b
wget -q -O temp.html "%url%%%a"
sed "/\(\{32\}\).swf/!d;{s/.*\(http:.*\{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 Update completed
echo.
echo The old list file swfs.txt is backed up as swfs.back
echo.
echo Please check if the new list file swfs.txt is correct, if not correct, please restore immediately
pause>nul
goto :eof
@echo off
title 9flash *.swf Let Me Download(Support breakpoint resuming) by:vkill V:1.0
if not exist swfs.txt (echo Missing file swfs.txt&pause>nul&goto :eof)
findstr . swfs.txt>nul ||(echo swfs.txt is empty&pause>nul&goto :eof)
set "t=test.tx"
:choose
cls
echo.
echo Please enter the name of the flash file you want to download, enter all for all download
echo.
set name=
set/p name= name=
if "%name%*"=="*" goto choose
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 Did not find the flash you want to search&pause>nul&goto choose)
cls
echo ________________________________________________________________________________
echo The list of flash works you want to search is as follows, automatic download starts after 5 seconds
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 Downloading work%%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 "
[ Last edited by vkill on 2007-1-15 at 06:06 AM ]| Rater | Score | Time |
|---|---|---|
| lxmxn | +4 | 2007-10-21 23:16 |