share/Scripts/m3u8下載/test.sh

46 lines
1.5 KiB
Bash

BASE="curl 'https://vod.live.eplus.jp/out/v1/f69369f0004d4e30a93381c0f9cf5c5c/76b6cf49f18ca1445cbd28b3f950733e/index_4_3847.ts' \
-H 'authority: vod.live.eplus.jp' \
-H 'pragma: no-cache' \
-H 'cache-control: no-cache' \
-H 'sec-ch-ua: \"Google Chrome\";v=\"93\", \" Not;A Brand\";v=\"99\", \"Chromium\";v=\"93\"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36' \
-H 'sec-ch-ua-platform: "Windows"' \
-H 'accept: */*' \
-H 'origin: https://live.eplus.jp' \
-H 'sec-fetch-site: same-site' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-dest: empty' \
-H 'referer: https://live.eplus.jp/' \
-H 'accept-language: zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja;q=0.6' \
-H 'cookie: CloudFront-Key-Pair-Id=XXX; CloudFront-Policy=XXX; CloudFront-Signature=XXX%XXX-XX-XX__; KOJIN_SHIKIBETSU=1234; MEMBER_ID=1234; TODOFUKEN_CODE=13; _ga=GA1.2.00.00; _gid=GA1.2.000.00; _gat_UA-44492173-17=1; _gat_gtag_UA_44492173_17=1' \
--compressed"
origin=$(echo $BASE | sed -e "s/[^']*'\([^\?^']*\).*'.*/\1/" )
file=${origin##*/}
file=$(echo $file | sed 's/[\*\.\&\?]/\\&/g')
p=test.ts
pp=$(echo $p | sed 's/[\*\.\&\?]/\\&/g')
ts="$(echo $BASE | sed "s,$file,$pp,") -o $p -w '%{http_code}'"
echo base: $BASE
echo
echo origin: $origin
echo
echo file: $file
echo
echo command: $ts
status_code=$(eval " $ts")
echo
echo status_code: $status_code
if [ $status_code != "200" ]; then
echo ERROR: $status_code, 下載失敗.
cat $p
exit 1
fi