40 lines
1016 B
Bash
Executable File
40 lines
1016 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# set -o xtrace ## To debug scripts
|
|
# set -o errexit ## To exit on error
|
|
# set -o errunset ## To exit if a variable is referenced but not set
|
|
|
|
|
|
function main() {
|
|
baseSeriesUrl="${1}"
|
|
r1="${2}"
|
|
r2="${3}"
|
|
videoName="${4}"
|
|
|
|
if [ -z $baseSeriesUrl ]; then
|
|
echo "Provide a base url please...."
|
|
fi
|
|
|
|
if [ -z $r1 ]; then
|
|
echo "Provide a starting range...."
|
|
fi
|
|
|
|
if [ -z $r2 ]; then
|
|
echo "Provide an ending range...."
|
|
fi
|
|
if [ -z $videoName ]; then
|
|
echo "Provide a base video name...."
|
|
fi
|
|
|
|
if [ -z $baseSeriesUrl ] || [ -z $r1 ] || [ -z $r2 ] || [ -z $videoName ]; then
|
|
return
|
|
fi
|
|
|
|
for (( i = $r1; i <= $r2; i++ )); do
|
|
url=`curl -s "${baseSeriesUrl}"/episode/episode-$i | grep file: | tail -n 1 | awk '{$1=$1};1' | sed 's/file: "//g' | sed 's/",//g'`
|
|
url=`clean-string.py "${url}"`
|
|
echo "curl " ${url} " --output \"${videoName} - 0$i.mp4\"" >> download.sh
|
|
done
|
|
}
|
|
main $@;
|