Using Yahoo Pipes to create TV Torrent RSS Feeds
Yahoo Pipes is pretty cool allowing someone to create their own feed based on an aggregate of other feeds. It simplifies things immensely for creating nifty feeds of various things. More appropriately, Yahoo Pipes is ripe for abuse by those of us who want to create a feed of tv show torrent files we would like to download. Where before I was filtering feeds locally, I choose to create a Pipe of the shows I want to download. This has the added benefit of letting you share the piped feed with other people so they can download the same torrents as you if they wish. So how do we go about creating this feed? Here is a slideshow of how to do just that. After it would be the same deal as before, but now we no longer need to do filtering. So here is the new code:
[code lang="python"]
#!/opt/local/bin/python2.5
import feedparser
import urllib2
DownloadPath = '/Users/abhi/Downloads/Feeds/'
DownloadLog = '/Users/abhi/.tvdownloads'
FeedUrl = 'http://pipes.yahoo.com/pipes/GBPk1Pm82xGRSPpPJxOy0Q/run?_render=rss'
def is_downloaded(link):
return link in open(DownloadLog, 'r+').read()
def write_log(link):
open(DownloadLog, 'a+').write('%s\n' % link)
def get_tvtorrents():
parser = feedparser.parse(FeedUrl)
for item in parser['items']:
if not is_downloaded(item['link']):
torrentfile = DownloadPath + item['title'].replace(' ', '_') + '.
torrent'
torrentdata = urllib2.urlopen(item['link']).read()
open(torrentfile, 'wb').write(torrentdata)
write_log(item['link'])
if __name__=='__main__':
get_tvtorrents()
[/code]
Comments [0]