Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #### Varliables ####
- NUMBER_OF_PAGES=3600
- #### Directories and file location ####
- COOKIE="$HOME/tvtz/cookie.txt"
- PAGES_DOWNLOAD="$HOME/tvtz/pages"
- ID_LIST="$HOME/tvtz/id_list"
- #### Funtions ####
- download_pages ()
- {
- for i in `cat $ID_LIST`;
- do
- if [ $NUMBER_OF_PAGES -lt 1 ]
- then
- exit
- else
- if [ -f $PAGES_DOWNLOAD/$i.html ]
- then
- continue
- else
- curl -o $PAGES_DOWNLOAD/$i.html -b $COOKIE "http://tvtorrentz.org/details.php?id=$i&filelist=1"
- NUMBER_OF_PAGES=$(( NUMBER_OF_PAGES-1 ))
- echo $NUMBER_OF_PAGES
- sleep 8
- continue
- fi
- fi
- done
- }
- delete_pages ()
- {
- mkdir ~/tvtz/temp/
- for i in `cat ~/tvtz/id_list`;
- do
- if [ -f ~/tvtz/pages/$i.html ]
- then
- mv ~/tvtz/pages/$i.html ~/tvtz/temp/
- continue
- fi
- done
- mv ~/tvtz/pages/* ~/tvtz/pages_deleted
- mv ~/tvtz/temp/* ~/tvtz/pages/
- rm -R ~/tvtz/temp/
- }
- #### Program start ####
- #Check cookie
- if [ -s $COOKIE ]
- then
- continue
- else
- if [ -s $HOME/.tvtz/tvtz_cookie.txt ]
- then
- cp $HOME/.tvtz/tvtz_cookie.txt $COOKIE
- continue
- else
- printf "\nERROR: $COOKIE is empty or does not exist\n"
- exit
- fi
- continue
- fi
- curl -b $COOKIE "http://tvtorrentz.org/godzilla_api.php?ak=76b4f23b3c4711b3cb1fe4caa1bf4ab5&action=get_torrent_ids" > ~/tvtz/id_list
- if [ -s $ID_LIST ]
- then
- download_pages
- delete_pages
- exit
- else
- printf "\nERROR: $ID_LIST is empty or does not exist\n"
- exit
- fi
Add Comment
Please, Sign In to add comment