首页 > 代码库 > 自动下载快手视频

自动下载快手视频

@echo off
:: 自动下载快手视频
:: 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

自动下载快手视频