I am always so impressed at the ease of using python. It lets you make such useful stuff with so little code(or programming experience).
This program depends on the python module feedparser (available at feedparser.org), It uses rss feeds provided by isohunt. The idea is you just need to to set your televison shows in this variable. below is a sample variable
feeds = [ ('medium', 350), ('the king of queens', 175), ('invasion', 350), ('two and a half men', 175), ('er', 0), ('yes dear', 175), ('deadwood', 0) ]
you need to set two parts, the first is the title. Make sure you include the full title, including works like: 'and', 'a', and 'the'. The second number is the file size of your avifiles. If you do not want to specify a target file size, set it to 0.
it seems you can only get current shows for about 5 to 6 days after they were released. So long as you run the script every 4 or so days you will not miss any new shows
to run it on linux, change to the directory you want your torrent files saved, then just run the script.
to run it on windows, just drag the file to the directory you want your torrents saved to and click on the icon.
here is the code
#!/usr/bin/env python
#
#
import os, feedparser, urllib
# this is the url used to search isohunt, 'shanenin' is used as a place holder
rss_url = 'http://isohunt.com/js/rss.php?ihq=shanenin&op=and&iht'
generic_download_url = 'http://isohunt.com/download.php?mode=bt&id=shanenin'
# fill this part with the names of shows you want to track, and
# the prefered file size of your download. enter 0 for no preference
# Entering 0 may retrun more bad torrents.
feeds = [ ('medium', 0), ('the king of queens', 175), ('invasion', 350), ('two and a half men', 175), ('er', 0), ('yes dear', 175), ('deadwood', 0) ]
# this function gets it parameter for the variable feed. Search is the first element of
# each tuple in feeds
def get_feed_obj(search):
url = rss_url.replace('shanenin', search[0].replace(' ', '+'))
feed_obj = feedparser.parse(url)
return feed_obj
# this function takes the summary, and parses out the file size in MBs
# this is used for the parse_rss()
def get_size(summary):
size = summary.split('Size:')[1]
size = float(size.split()[0])
return size
# this function takes the link and parses out the torrent id, this is used for
# the parse_rss()
def get_id(v_link):
id = v_link.split('id=')[1]
return id
# this function checks if a directory is already made, if not it makes it
def mkdir(name):
if os.path.isdir(name) == False:
os.mkdir(name)
# function either returns feed with '.' for spaces, or '_'
def clean_feeds(feed, delimeter):
cfeed = feed.replace(' ', delimeter).lower()
return cfeed
def main():
for i in feeds:
direc = clean_feeds(i[0], '_')
mkdir(direc)
search_term = "%s."% clean_feeds(i[0], '.')
size_parse = i[1]
feed_obj = get_feed_obj(i)
for i in range(len(feed_obj.entries)):
title = feed_obj.entries[i].title.lower()
id = get_id(feed_obj.entries[i].link)
size = get_size(feed_obj.entries[i].summary)
print_size = str(int(size))
modified = feed_obj.entries[i].modified
if title.startswith(search_term):
if size_parse == 0 or size >= size_parse - 4 and size <= size_parse +4:
download_url = generic_download_url.replace('shanenin', id)
saved_title = "%s/%s.%s.torrent" %(direc, title, print_size)
urllib.urlretrieve(download_url, saved_title)
main()