Archive for the ‘snippet’ category

Downloading daily TV torrents on ThePirateBay

October 14th, 2010

There are many torrent download scripts online, I even uploaded one a while back, but this one allows you to selectively download episodes that have a date identifier rather than an episode identifier. Once again this is written in python, all you have to do is modify the source variable to contain the search string for your show, create a file in the same folder called downloaded and modify the watch_folder to the folder where you want the torrents to be downloaded to.  Have Fun

import os
import sys
from commands import getoutput
downloaded = getoutput('cat downloaded')
watch_folder = "/torrent/watch/"
source = getoutput('curl -s "http://thepiratebay.org/search/TV%20Show%20XviD/0/0/0" | grep "http://torrents.thepiratebay.org"').split("\n")
for item in source:
    item = item.split('"')[1]
    torrent_link = item
    item = item.split(".")
    date = item[5] + "." + item[6] + "." + item[7]
    if date not in downloaded:
        os.system('cd ' + watch_folder + ' && wget "' + torrent_link + '"')
        os.system('echo "' + date + '" >> downloaded')
        downloaded = getoutput('cat downloaded')