概述
目标:http://www.tucao.tv/play/h4033225/
审查元素发现弹幕接口:http://www.tucao.tv/index.php?m=mukio&c=index&a=init&playerID=27-4033225-1-0&r=230
查看源代码发现:http://www.tucao.tv/index.php?m=mukio&c=index&a=tj&playerID=27-4033225-1-0
可见只需要把a=tj替换为a=init即可,至于P数由最后一个数字确定,即
http://www.tucao.tv/index.php?m=mukio&c=index&a=tj&playerID=27-4033225(视频号)-1-0(P数,由0开始)
代码
@echo off
set target=http://www.tucao.tv/play/h4033225/
set pnum=40
if "%target%"=="" set /p target=请粘贴目标网址:
if "%pnum%"=="" set /p /a pnum=请输入P数:
set /a pnum=%pnum%-1
:get_target
curl -k -L -# -o target_utf8.temp %target%#%%j -e "%target%" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36"
if exist target_utf8.temp (
iconv -c -f UTF-8 -t GBK target_utf8.temp > target_gbk.temp
sed -i "s#\"#\n#g" target_gbk.temp
sed -i "s#><#>\n<#g" target_gbk.temp
if exist *. del *.
egrep "m=mukio" target_gbk.temp | sed "s/a=tj/a=init/g;s/.$//g;s/^&/^^^&/g" > target_xml.temp
egrep "<title>" target_gbk.temp | sed "s/<title>//g;s/<\/title>//g;s/吐槽弹幕网//g;s/tucao.tv//g;s/[[:blank:][:punct:]]//g" > target_title.temp
) else ( goto get_target )
:get_xml
for /f %%t in (target_title.temp) do (
if not exist %%t md %%t
for /l %%n in (0 1 %pnum%) do (
cat target_xml.temp | xargs -n 1 -P 10 -I {} curl -k -L -# --compressed -o %%t\E%%n.xml {}%%n -e "%target%" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36"
)
)
:end
if exist *. del *.
pause
if exist *.temp del *.temp
pause
网友评论