Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download FGO video
#!/bin/sh
#
# Usage:
# sh ./download_fgo_video.sh https://extend.data.fate-go.jp/xXxx0Xxx/PathCRC
#
# PathCRC URL
TARGET_URL=$1
FGO_VER='2.2.0.1'
UA="fategrandorder/$FGO_VER CFNetwork/1120 Darwin/19.0.0"
HEADERS='X-Unity-Version: 2018.4.4f1'
BASE_URL=$(echo $TARGET_URL | awk -F '/' -v 'OFS=/' '{print $1,$2,$3,$4}')
PATH_ID=$(echo $TARGET_URL | awk -F '/' '{print $4}')
LIST=$(curl -s -A "$UA" --header "$HEADERS" $TARGET_URL | awk -F ',' '{print $1}')
SCRIPT_PATH=$(dirname $0)
for REQ_PATH in $LIST
do
SAVEPATH=$(dirname $REQ_PATH)
if [ ! -e $SCRIPT_PATH/$SAVEPATH ] ; then
mkdir -p $SCRIPT_PATH/$SAVEPATH
fi
if [ -e $SCRIPT_PATH/$REQ_PATH ] ; then
rm $SCRIPT_PATH/$REQ_PATH
fi
curl -A "$UA" --header "$HEADERS" -s -o "$SCRIPT_PATH/$REQ_PATH" "$BASE_URL/$REQ_PATH"
COMPNAME=$(echo $REQ_PATH | awk -F '[/.]' '{print $3}')
COMPNAME="${COMPNAME}.mp4"
cat $SCRIPT_PATH/$REQ_PATH >> $SCRIPT_PATH/$COMPNAME
done
#rm -rf $SCRIPT_PATH/$SAVEPATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment