原始地址:https://dev.to/iw4p/how-to-download-torrent-files-python-25ll
'''
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()
You don’t have the torrent file? just a magnet link? no problem
fr