Hello all, today I am going to demonstrate you a simple script which will automate torrents download, a never ending task. This will be a lot of help specially when you have to download episodes of your favorite TV shows every week. Wouldn’t it be awesome if your computer does it for you? (Remember not to get in legal troubles)
If you don’t know, selenium is web browser automation tool. Primarily it is used for automating web applications on web applications. Selenium has the support of some of the largest browser vendors who have taken (or are taking) steps to make Selenium a native part of their browser. You can read more about selenium here.
Selenium currently provides client APIs for Java, C#, Ruby and Python. I have used selenium with python. You can use any of the above language according to your comfort. This small tutorial will get you started on installation of python bindings for selenium and basic examples of how to use it. Before going in detail, I would like to say that script is for educational purpose only and you could get in legal trouble if you download illegal content from torrent website. I will not be responsible if you get in any kind of trouble by using this. So this being said, lets get started..
As selenium only supports web apps automation, I have used torrent caching site to automate torrents download. Here is the list of popular torrent caching websites. I have used Filestream.me in the script but you can use anyone you like with slight changes. Simple algorithm for the script goes like, it will first log in to the filestream, then it will find torrent magnet URL from piratebay and finally it will download the torrent files in zip format using that magnet URL from filestream. Simple!
You can download the script on below link. But keep in mind, this script is very basic just to give you idea of how to automate torrents download, you can modify it according to your need. (As the script is website dependent, any change in website may leave it useless!). One last important thing, script will work only if pirate bay is up and running (which is up most of the time). And if thepiratebay.org is not working, you can modify script to look for couple of pirate bay mirros and get url from any one of mirror. Here is the list of pirate bay proxies. Most part of the script is self explanatory but still if you have some doubt, you can comment it down.
Here is the live demo of script running on my linux system.
You can develop algorithm using this script to search and download multiple torrents. You can also use cron utility to run this script at specific times in a day to get those TV shows in your computer as soon as they are released. (Do not download any illegal content though xD). I will leave that part as an exercise for you. Sit back and relax as your computer automatically download things for you, cheers!