1 @echo off 2 chcp 65001 1>nul 2>nul 3 4 set url=%~1 5 6 curl -s -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" -H "Upgrade-Insecure-Requests: 1" %url% > page.html 7 8 cat page.html | d:msysopt oolsingrep -oP "(?<=/)d+(?=/)" > vid.txt 9 10 set /p vid=<vid.txt 11 12 IF EXIST vid.txt del /Q vid.txt 13 IF EXIST page.html del /Q page.html 14 15 ::echo %vid% 16 set redirect_url=https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=%vid% 17 ::echo %redirect_url% 18 19 curl -s -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" -H "Upgrade-Insecure-Requests: 1" %redirect_url% > viode.json 20 21 cat viode.json | jq -M ".item_list[]|"(.author.short_id)_(.author.nickname)_(.desc).mp4"" > filename.txt 22 cat viode.json | jq -M ".item_list[].video.play_addr.url_list[]" |sed "s/playwm/play/g" > videourl.txt 23 24 set /p filename=<filename.txt 25 set /p videourl=<videourl.txt 26 27 IF EXIST filename.txt del /Q filename.txt 28 IF EXIST videourl.txt del /Q videourl.txt 29 IF EXIST viode.json del /Q viode.json 30 31 echo %filename% 32 echo %videourl% 33 34 curl -s -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" -H "Upgrade-Insecure-Requests: 1" -L %videourl% > %filename% 35 36 set filename= 37 set videourl= 38 set vid= 39 set redirect_url=
需要 CURL JQ GREP SED
注意: 要用支持 -P 参数GREP版本