Python Automation

Best way to Automate torrents download using python and selenium

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!

the pirate bay

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.

You can download the script to automate torrents download here or on GitHub.

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!

Sharing is caring!

  1. bulk sms provider india

    Hey there, You’ve executed a wonderful job. I am going to unquestionably delicious the idea and for our aspect suggest to my friends. My business is confident they’ll be benefited from this excellent website.. bulk sms provider india


    I’m just don’t sure your location taking your information and facts, having said that great matter. I’ve got to expend a little while mastering much more and also knowing more. Many thanks for excellent info I’m in search of this info for my assignment.

  3. android bulk sms

    Practical data android bulk sms. Fortuitous me personally I stumbled upon your website by mistake, exactly what astonished precisely why this accident failed to transpired beforehand! We book-marked the item.

  4. ترجمه رسمی هندی

    You realize as a result considerably concerning this topic, made us individually accept is as true through a lot of many aspects.. ترجمه رسمی هندی The like individuals will not be fascinated until eventually it really is something to achieve using Girl coo! Your own personal things wonderful. On a regular basis ensure that is stays in place!

  5. Aimee

    It’s a pity you don’t have a donate button! I’d without a doubt donate to this fantastic blog!
    I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to fresh updates and will share this blog with my Facebook
    group. Talk soon!

  6. Cristine

    Nice post. I was checking constantly this blog and I’m impressed!
    Extremely useful information particularly the last part
    🙂 I care for such info much. I was looking for this certain information for a very
    long time. Thank you and good luck.

Leave a Reply

Your email address will not be published. Required fields are marked *