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 (2)

Collapse
 
yassine353 profile image
Yassine BENNKHAY • Edited on

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 Author

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

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.