Mininova SSATEUR: Site-Specific Automatic Torrent Extractor Using RSS Authored By: Andrew Rowls !--> Works ONLY with torrent feeds from http://www.mininova.org/ !--> If this script successfully parses feeds from any other site, it's sheer coincidence #####==============-------------- IMPORTANT: While mininova has not implemented CAPTCHAs, you should still be courteous towards them in terms of bandwidth usage. While I don't believe this script will particularly tax mininova'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 mininova bans your IP for excessive bandwidth usage (or any other reason, for that matter) #####==============-------------- This script parses a list of feeds ($feeds). For each feed, the episode name and season/episode numbers are checked against the database ($db). If the episode is not found as "gotten", the associated .torrent file is downloaded to the specified directory ($dest), where it will be left for whatever Torrent Management System you run. Upon download, the episode will be added to the database $db stores the database, however crude it may be. It is a simple text file of the format $show_name $season_number $episode_number $show_name = the show's full name with periods (.), underscores (_), apostrophes ('), and dashes (-) replaced with spaces ( ), and multiple spaces ( ) reduced to single spaces ( ). $season_number and $episode_number have any leading zeros stripped (01 becomes 1). This is the format expected by the script. If a line does not match this format, the script may or may not match it to an existing torrent. If it matches, the torrent will not be downloaded. Lines in the database file can be commented out with a leading pound (or "hash") sign (#). If you see something weird in the db file (like the show name includes the particular episode's title), then probably the torrent author gave it a non-standard name. $dest = directory the torrent file will be downloaded to. $feeds is a list of RSS feeds to look through. Each feed should appear on its own line. Lines can be commented out with a leading pound/hash sign (#), so you can easily keep track of your feeds. Again, ONLY feeds from http://www.xtvi.com/all_tv_shows should be used. As mininova does not implement CAPTCHAs (yet), cookies and login user/pass are not required for automatic torrent downloading. As such, the cookies variable is turned off, and the wgetopts variable is set to blank. This provides a placeholder, should we ever need to implement a login and cookie-saving. What about those stupid torrents with "private trackers"? Fortunately, it seems that mininova puts the url of a private tracker, surrounded with square brackets, inside the titles of torrents with private trackers. This allows the script to search for anything inside square brackets -- if anything matched, it skips that torrent as privately-tracked. Unfortunately, some groups who use open trackers also use square brackets (sometimes a torrent with "[eztv]" will show up, no private tracker to be seen). These torrents will also be skipped. I've implemented a "save" for the specific [eztv] case, which should be easily adaptable to other uses. ## Currently Irrelevant ## $cookies is a plain text file used to store wget cookies from mininova. This is required for logging in to mininova, which is required for automatically downloading torrent files from mininova. Without a login, the script will run into a captcha, and captchas require Artificial (or Actual) Intelligence to solve. Needless to say, I'm not going to incorporate such silliness into a simple script. There is no need to create this file yourself, as wget will create it the first time it needs it. Once created, you should not edit it beyond deleting cookies. Change $user and $pass to your own mininova creds.