S
S
sortfact3332021-02-15 16:54:30
Python
sortfact333, 2021-02-15 16:54:30

How to start torrenting in python?

I want to automatically create a torrent file and start streaming using python
I found the torf module
And created the first torrent file

from torf import Torrent
t = Torrent(path='text.txt',
            trackers=['udp://tracker.openbittorrent.com:80/announce',
                      'udp://tracker.opentrackr.org:1337/announce'],
            comment='This is a comment')
t.private = True
t.generate()
print(t.magnet())
t.write('my.torrent')


But the code does not add the file to the distribution, and therefore, when I try to download the file, Connecting to peers does not go further.
How can I also start automatically distributing the file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
David on the headstock, 2021-02-15
@sortfact333

I advise you to read the answer here: https://ru.stackoverflow.com/questions/1239765/How to...
updated:
You should probably run your file and be sure to specify the download folder where your files are already located for distribution
upd2 :
You it's worth using python-qbittorrent to start downloading your file right away. Before that, you must activate the web interface, it's easy: * click *

from qbittorrent import Client

qb = Client('http://127.0.0.1:8080/')

qb.login()
dl_path = 'special-dir/'

torrent_file = open('my-torrent-file.torrent', 'rb')
qb.download_from_file(torrent_file, savepath=dl_path)

A little later I can write the full code for your needs :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question