Update 'download.sh'
This commit is contained in:
parent
a97b6073d9
commit
2d5b1a5cbe
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# .env contains a line like
|
# .env contains a line like
|
||||||
# BASE64_ENCODED_BEARER_TOKEN='<literal base64 encoded string>'
|
# BASE64_BEARER_TOKEN='<literal base64 encoded string>'
|
||||||
source .env
|
source .env
|
||||||
OUTFILE_PATTERN="./videos/video_INDEX.mp4"
|
OUTFILE_PATTERN="./videos/video_INDEX.mp4"
|
||||||
API_URL='https://euwe-1.api.microsoftstream.com/api/videos?'\
|
API_URL='https://euwe-1.api.microsoftstream.com/api/videos?'\
|
||||||
|
@ -12,7 +12,7 @@ API_URL='https://euwe-1.api.microsoftstream.com/api/videos?'\
|
||||||
'api-version=1.4-private'
|
'api-version=1.4-private'
|
||||||
|
|
||||||
mkdir -p "$(dirname "${OUTFILE_PATTERN}")" || { echo -e '\033[31mAborting\033[m'; exit; }
|
mkdir -p "$(dirname "${OUTFILE_PATTERN}")" || { echo -e '\033[31mAborting\033[m'; exit; }
|
||||||
m3u8_manifest_urls=$(wget --no-verbose --quiet -O- --header="authorization: Bearer ${BASE64_ENCODED_BEARER_TOKEN}" "${API_URL}" | jq -r '.value[].playbackUrls | map(select(.mimeType == "application/vnd.apple.mpegurl")) | .[].playbackUrl')
|
m3u8_manifest_urls=$(wget --no-verbose --quiet -O- --header="authorization: Bearer ${BASE64_BEARER_TOKEN}" "${API_URL}" | jq -r '.value[].playbackUrls | map(select(.mimeType == "application/vnd.apple.mpegurl")) | .[].playbackUrl')
|
||||||
|
|
||||||
idx=1
|
idx=1
|
||||||
total=$(echo "${m3u8_manifest_urls}" | wc -l)
|
total=$(echo "${m3u8_manifest_urls}" | wc -l)
|
||||||
|
@ -25,9 +25,9 @@ echo -e "\033[32mDownload video ${idx} of ${total}\033[m"
|
||||||
outfile="$(echo "${OUTFILE_PATTERN}" | sed "s/idx/${idx}/g")"
|
outfile="$(echo "${OUTFILE_PATTERN}" | sed "s/idx/${idx}/g")"
|
||||||
|
|
||||||
# This doesn't work for some reason
|
# This doesn't work for some reason
|
||||||
# ffmpeg -loglevel 24 -headers "authorization: Bearer ${BASE64_ENCODED_BEARER_TOKEN}" -i "${m3u8_highest_res_url}" -c copy "${outfile}"
|
# ffmpeg -loglevel 24 -headers "authorization: Bearer ${BASE64_BEARER_TOKEN}" -i "${m3u8_highest_res_url}" -c copy "${outfile}"
|
||||||
# Don't know what the f is going on, but it only works this hacky way
|
# Don't know what the f is going on, but it only works this hacky way
|
||||||
echo 'ffmpeg -loglevel 24 -headers "authorization: Bearer '${BASE64_ENCODED_BEARER_TOKEN}'" -i "'${m3u8_highest_res_url}'" -c copy "'${outfile}'"' | sh
|
echo 'ffmpeg -loglevel 24 -headers "authorization: Bearer '${BASE64_BEARER_TOKEN}'" -i "'${m3u8_highest_res_url}'" -c copy "'${outfile}'"' | sh
|
||||||
echo -e "\033[33mDone\033[m"
|
echo -e "\033[33mDone\033[m"
|
||||||
|
|
||||||
idx=$((idx+1))
|
idx=$((idx+1))
|
||||||
|
|
Loading…
Reference in New Issue