Skip to content

Instantly share code, notes, and snippets.

@siilver777
Created October 15, 2018 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siilver777/3beecfee5629ff24c38fba9717a20325 to your computer and use it in GitHub Desktop.
Save siilver777/3beecfee5629ff24c38fba9717a20325 to your computer and use it in GitHub Desktop.
South Park Downloader (French voices)
#!/bin/bash/
# Variables and parameters
firstBaseUrl="http://south-park-tv.eu/videos"
secondBaseUrl="http://46.4.106.41"
startFromSeason=${1:-1}
endAtSeason=${2:-21}
baseFolder=$(pwd)
declare -a seasons=(
[1]=13
[2]=18
[3]=17
[4]=17
[5]=14
[6]=17
[7]=15
[8]=14
[9]=14
[10]=14
[11]=14
[12]=14
[13]=14
[14]=14
[15]=14
[16]=14
[17]=10
[18]=10
[19]=10
[20]=10
[21]=10
)
# Download
for i in "${!seasons[@]}"
do
cd "$baseFolder"
if [[ $startFromSeason -le $i && $endAtSeason -ge $i ]]
then
mkdir -p "Saison ${i}"
cd "Saison ${i}"
for j in $(seq -f "%02g" 1 ${seasons[$i]})
do
# Determines the start of the url
if [ $i -ge 17 ] || [ $i -eq 3 ] # After season 17, new url. Season 3 too.
then
startUrl=$secondBaseUrl
else
startUrl=$firstBaseUrl
fi
# Determines the end of the url
if [ $i -eq 1 ] && [ $j -eq 1 ] # The first episode with sound fixed
then
endUrl="new.mp4"
elif [ $i -eq 19 ] && [ $j -eq 8 ] # The 19x08 is only available in english
then
endUrl=".mp4"
elif [ $i -eq 17 ] || [ $i -eq 19 ] && [ $j -eq 1 ] # Season 17 & 19x01 adds "fr" at the end
then
endUrl="fr.mp4"
elif [ $i -ge 18 ] && [ $i -le 20 ] # Seasons 18 to 20 adds "vf" at the end
then
endUrl="vf.mp4"
elif [ $i -eq 21 ] && [ $j -eq 1 ] # 21x01 adds "fr1" at the end
then
endUrl="fr1.mp4"
elif [ $i -eq 21 ] && [ $j -eq 2 ] # 21x02 adds "fr2" at the end
then
endUrl="fr2.mp4"
elif [ $i -eq 21 ] # Season 21 adds "fr" at the end
then
endUrl="fr.mp4"
else
endUrl=".mp4"
fi
echo "Saison ${i} - Episode ${j}"
curl -O "${startUrl}/saison${i}/${i}x${j}${endUrl}"
done
fi
done
# Display date
date +"
Total download ended at %Y-%m-%d %H:%M:%S"
# Reset Terminal state
unset seasons
cd "${baseFolder}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment