Skip to content

Instantly share code, notes, and snippets.

@fabriciorsf
Last active June 29, 2016 13:33
Show Gist options
  • Save fabriciorsf/7816a2e4f9c372fd015ba7e78cfbf9aa to your computer and use it in GitHub Desktop.
Save fabriciorsf/7816a2e4f9c372fd015ba7e78cfbf9aa to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ "$#" -lt 3 ]; then
echo "Usage: $0 <anime-url> <first_episode_number> <last_episode_number>"
echo "Example: $0 'dragon-ball-super' 1 49"
exit 1
fi
ANIME=$1
shift
EPISODE_FIRST=$1
shift
EPISODE_LAST=$1
shift
URL_ROOT='http://www.animesonlines.com.br/'
URL1='/episodio-'
URL2=${URL_ROOT}'baixar?file='
URL3=${URL_ROOT}'download.php?file='
PATH_ANIME="${PWD}/${ANIME}"
if [ ! -d "${PATH_ANIME}" ]; then
echo "creating directory ${PATH_ANIME}"
mkdir ${PATH_ANIME}
fi
for ((i = ${EPISODE_FIRST}; i <= ${EPISODE_LAST}; i++));
do
printf -v i_str '%0'${#EPISODE_LAST}'d' $i
FILE="${PATH_ANIME}/${ANIME}_ep_${i_str}.mp4"
URL="${URL_ROOT}${ANIME}${URL1}$i"
echo "ACESSANDO: $URL" # http://www.animesonlines.com.br/dragon-ball-super/episodio-42
BAIXAR_ID=`curl -s "${URL}" | grep "$URL2" | cut -d "=" -f 19 | cut -d "\"" -f 1`
URL="${URL2}$BAIXAR_ID"
echo " ACESSANDO: $URL" # http://www.animesonlines.com.br/baixar?file=69283
BAIXAR_ID=`curl -s "${URL}" | grep "FILEENCODE = '" | cut -d "'" -f 2`
URL="${URL3}$BAIXAR_ID"
echo " BAIXANDO: $URL" # http://www.animesonlines.com.br/download.php?file=NSw0ZjMzMDdmNzI0YzJkMzY1
wget $URL -O $FILE
#sleep 1m
done
echo "FINISHED!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment