自动下载快手视频

@echo off
:: 自动下载快手视频 v1.0
:: get kuaishou video _GKV
:: _kslists.txt - https://www.kuaishou.com/live/user/xxx 支持多行 
:: 从 _kslists.txt 文本中读取URL并自动下载该页面的所有视频

setlocal enabledelayedexpansion

for /f "delims=" %%i in ('type _kslists.txt') do (
  call :getAllVideo "%%i"
)
exit /b

:getAllVideo
set url=%1
set savepage=save_%random%-%random%-%random%.html
wget %url% -O "%savepage%"

sed -i "s/.jpg/.jpg\r\n/g" "%savepage%"
sed -i "s/http/\nhttp/g" "%savepage%"
set tempfn=%savepage%.info.txt
cat "%savepage%"|grep -Eio "https(.*)upic.*.jpg">"%tempfn%"
sed -i "s/.jpg/.mp4/g" "%tempfn%"

set /a index=1
for /f "delims=" %%i in ('type %tempfn%') do (
  set outfn=!date!_!time:~0,8!_!index!.mp4
  set outfn=!outfn::=.!
  set outfn=!outfn: =0!
  set inurl=%%i
  set /a index=!index!+1
  wget "!inurl!" -O "!outfn!"
)

del "%savepage%"
del "%tempfn%"
exit /b

-------------------------------------------------------------------
GKV_v1.7 优化了一些功能
GKV_v1.7.cmd.7z
posted @ 2017-04-27 04:27  1CM  阅读(626)  评论(0编辑  收藏  举报