feat: add m3u8 download script
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
e3db2988f8
commit
adf5b2c60f
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
# the directory of the script
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# the temp directory used, within $DIR
|
||||
# omit the -p parameter to create a temporal directory in the default location
|
||||
WORK_DIR=`mktemp -d -p "$DIR"`
|
||||
|
||||
# check if tmp dir was created
|
||||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||
echo "Could not create temp dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# deletes the temp directory
|
||||
function cleanup {
|
||||
rm -rf "$WORK_DIR"
|
||||
echo "Deleted temp working directory $WORK_DIR"
|
||||
}
|
||||
|
||||
# register the cleanup function to be called on the EXIT signal
|
||||
# trap cleanup EXIT
|
||||
|
||||
echo "請輸入m3u8網址: ( copy as cURL(bash) )"
|
||||
read m3u8
|
||||
|
||||
echo "請輸入其中一個ts的網址: ( copy as cURL(bash) )"
|
||||
read BASE
|
||||
|
||||
m3u8="${m3u8} -o index.m3u8"
|
||||
cd $WORK_DIR
|
||||
# echo $(pwd)
|
||||
eval " $m3u8"
|
||||
|
||||
origin=$(echo $BASE | sed -e "s/[^']*'\([^\?^']*\).*'.*/\1/" )
|
||||
file=${origin##*/}
|
||||
file=$(echo $file | sed 's/[\*\.\&\?]/\\&/g')
|
||||
|
||||
echo BASE: $BASE
|
||||
echo origin: $origin
|
||||
echo file: $file
|
||||
|
||||
while read p; do
|
||||
if [[ $p != "#"* ]]; then
|
||||
pp=$(echo $p | sed 's/[\*\.\&\?]/\\&/g')
|
||||
ts="$(echo $BASE | sed "s,$file,$pp,") -o $p"
|
||||
|
||||
eval " $ts"
|
||||
|
||||
fi
|
||||
done <index.m3u8
|
||||
|
||||
ffmpeg -i "index.m3u8" -codec copy ../output.mp4
|
|
@ -0,0 +1,33 @@
|
|||
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 -e "s,$file,$pp,")
|
||||
|
||||
echo base: $base
|
||||
echo
|
||||
echo origin: $origin
|
||||
echo
|
||||
echo file: $file
|
||||
echo
|
||||
echo command: $ts
|
Loading…
Reference in New Issue