批处理下载最新 ffmpeg 代码

@echo off

set url=https://git.ffmpeg.org/gitweb/ffmpeg.git

set httpProxy=127.0.0.1:9777

set rdn=%random%_%random%_%random%
set outf=tmp_%rdn%.html

wget -e use_proxy=yes -e http_proxy=%httpProxy% -e https_proxy=%httpProxy% %url% -O %outf%

:: <td title="2020-07-20"><i>2 hours ago</i></td>
:: cat %outf% | sed "s/>/>\n/g" | grep -Eoi "title=.[0-9]{4}-[0-9]{2}-[0-9]{2}." | grep -Eoi "[0-9]{4}-[0-9]{2}-[0-9]{2}"
set srcdate=
FOR /F %%i IN ('cat %outf% ^| sed "s/>/>\n/g" ^| grep -Eoi "title=.[0-9]{4}-[0-9]{2}-[0-9]{2}." ^| grep -Eoi "[0-9]{4}-[0-9]{2}-[0-9]{2}"') DO (
  set srcdate=%%i
  goto next1
)
:next1
set srcdate=%srcdate:-=%
echo %srcdate%

:: <a href="/gitweb/ffmpeg.git/snapshot/ba31fdfd7b7d5a077f3328bc8da5e61582b88354.tar.gz" title="in format: tar.gz">snapshot</a>
:: cat %outf% | sed "s/>/>\n/g" | grep -Eoi "/gitweb/ffmpeg.git/snapshot/(.*?)\.tar.gz"
set srcurl=
FOR /F %%i IN ('cat %outf% ^| sed "s/>/>\n/g" ^| grep -Eoi "/gitweb/ffmpeg.git/snapshot/(.*?)\.tar.gz"') DO (
  set srcurl=https://git.ffmpeg.org%%i
  goto next2
)

:next2
echo %srcurl%

set savefn=ffmpeg-%srcdate%-%srcurl:~50,7%.tar.gz
echo %savefn%

::wget -e use_proxy=yes -e http_proxy=%httpProxy% -e https_proxy=%httpProxy% %srcurl% -O %savefn%
curl --socks5-hostname %httpProxy% -k %srcurl%>%savefn%

del /Q %outf%

pause

 

posted @ 2020-07-20 22:29  1CM  阅读(246)  评论(0编辑  收藏  举报