DEV Community

Nima Akbarzadeh
Nima Akbarzadeh

Posted on • Updated on

How to Download Torrent Files - Python

Image description
I searched a lot and I didn’t find anything EASY and FAST for downloading torrent files with python on Google colab. So I decided to start writing my own wrapped library for downloading torrent files.

TorrentP is a great and easy way to download torrent files, on your local machine or even google Colab!

Make sure you have Python installed, Then you can download it with this command on your terminal:

pip install torrentp After that you just have 3 steps:

Create a .py file
Copy and paste 3 lines
Run the script file and wait until it downloads completely!
If you have a torrent file use it like this:

from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("test.torrent", '.')
torrent_file.start_download()

Enter fullscreen mode Exit fullscreen mode

You don’t have the torrent file? just a magnet link? no problem

from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("magnet:...", '.')
torrent_file.start_download()

Enter fullscreen mode Exit fullscreen mode

It’s free and open source! you can fork and star it on Github if you enjoy it or if you like to add a new feature!

Project on GitHub: Github
PyPi Link: PyPi

Don’t forget to star it!

Top comments (4)

Collapse
 
deep_surya31 profile image
Suryadeep

Good job with the wrapper. Very useful.
However, I don’t see a way to pass proxy_settings or any other information to configure torrent download. Am I missing something?

Collapse
 
iw4p profile image
Nima Akbarzadeh

Thank you.
I have not implemented other features like proxy or continue/pause.
Maybe setting proxy on your terminal can help, I'm not sure.
Something like HTTP_PROXY=IP:PORT on your terminal.

Collapse
 
yassine_dev profile image
Yassine BENNKHAY • Edited

If you have the torrent file, shall we provide its path? How can the program knows the path of that "test.torrent"?

Collapse
 
iw4p profile image
Nima Akbarzadeh

you can give it path like /tmp/test/file.torrent
"test.torrent" means "./test.torrent"