#!/bin/bash #############==============-------------- # XTVI SSATEUR: Site-Specific Automatic Torrent Extractor Using RSS # Authored By: Andrew Rowls # !--> Works ONLY with torrent feeds from http://www.xtvi.com/all_tv_shows # !--> If this script successfully parses feeds from any other site, it's sheer coincidence # #####==============-------------- # IMPORTANT: XTVI has implemented CAPTCHAs for a reason. "To protect our servers from heavy # traffic". And I agree. While I don't believe this script will particularly tax XTVI's # servers simply by being run once, you should not be so rude as to run it many times # within a short time span, especially if you have many feeds you check. Since TV shows # typically don't air more than once a week, ideally you should only run this script # once a week. However, since it is typically desirable to have a copy of a show by the # day after it airs, I would recommend running the script no more than once per day, at # least several hours after the latest show of interest has aired. For example, my shows # typically air around 8-10PM EDT. The torrents for these shows are guaranteed to show up # by 5AM the next morning. Therefore, I have cron set to run this script once per day at # 5AM. This almost guarantees that I will be able to start downloading shows from the # previous night. # Again, please be courteous when setting this script to run. And don't blame me if XTVI # freezes, bans, locks, or warns you, for whatever reason. # #####==============-------------- # See the README for an explanation of the script # #####==============-------------- # # Fixes some issues with CRON's default env. Change HOME to your home directory, or remove if appropriate PATH=/bin:/usr/bin:/usr/sbin:$PATH HOME=/home/andrew db=~/bin/xtvirss/gotten.txt dest=/torrents/loading feeds=~/bin/xtvirss/feeds.txt cookies=~/bin/xtvirss/cookies.txt # Change these. user=xtvi_username pass=xtvi_pass cookies=`echo "$cookies" | replace " " "\ "` wgetopts="--keep-session-cookies --load-cookies $cookies --save-cookies $cookies" # Check if XTVI is up. If not, wait 2hrs before trying again. Etc. ping=`ping -c 1 -t 60 xtvi.com 2>&1 | grep "\(unknown host\)\|\(Time to live exceeded\)\|\(opendns.com\)" -c` while [ $ping -eq 1 ]; do echo -e "`date`\tXTVI.com is down." sleep 120m ping=`ping -c 1 -t 60 xtvi.com 2>&1 | grep "\(unknown host\)\|\(Time to live exceeded\)\|\(opendns.com\)" -c` done # If not logged in, log in to avoid captchas logged=`cat "$cookies" | grep "\($user\)\|\($pass\)" -c` if [ $logged -ne 2 ]; then wget $wgetopts --post-data "mode=dologin&name=$user&pass=$pass" -O /dev/null http://www.xtvi.com/torrents.php?mode=login 2>/dev/null fi feeds=`cat "$feeds" | grep -v "^#"` for RSS in $feeds; do titles=`wget $RSS -O- 2>/dev/null | grep "