PyTorrent is a CLI tool that downloads files from the BitTorrent network.
I wanted to make my own functional and straightforward program to learn how does BitTorrent protocol work and improve my python skills.
It is almost written from scratch with python 3.7, only the pubsub library was used to create events when a new peer is connected, or when data is received from a peer. You first need to wait for the program to connect to some peers first, then it starts downloading.
This tool needs a lot of improvements, but it does its job, you can :
But you can’t :
Don't hesitate to ask me questions if you need help, or send me a pull request for new features or improvements.
You can run the following command to install the dependencies using pip
pip install -r requirements.txt
:boom: Because it's using the "select" function, this code will not be able to run on Windows: python-select-on-windows
Simply run:
python main.py /path/to/your/file.torrent
The files will be downloaded in the same path as your main.py script.
I wouldn't have gone that far without the help of Lita, Kristen Widman's & the Bittorrent Unofficial Spec, so thank you.