arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.16k stars 994 forks source link

Enable WebTorrent in Python #7333

Open ghost opened 1 year ago

ghost commented 1 year ago

Hi, I was wondering if WebTorrent is enabled by default in the Python version of Libtorrent (pip3 install libtorrent). When I seed, I can download with qBittorrent but not instant.io. So I was wondering if there is a special property that needs to be enabled, or a specific version to download, in order to enable WebTorrent support. Thank you.

arvidn commented 1 year ago

Webtorrent is only available in master, which does not have an official release or build uploaded to pypi yet. To get webtorrent support, you'd have to build the python module yourself, from the master branch.

ghost commented 1 year ago

I'm a bit of a novice, could I please have instructions on how to build the python module from Master with WebTorrent enabled? And so that I can package the module using PyInstaller, if possible. Thanks!

uyjulian commented 1 year ago

Basically:

sudo apt-get install libboost-all-dev
python3 -m pip install --global-option="--b2-args=webtorrent=on" git+https://github.com/arvidn/libtorrent.git@master
ghost commented 1 year ago

Thank you, I built the python module myself and pip show libtorrent shows the version is 2.1.0. But I still can't download or seed files to/from instant.io. I read in another thread that a flag needs to be enabled when you install libtorrent in order for WebTorrent to work. Is this the same case here for installing with pip? Here is my code for downloading I copied from stackoverflow:

import libtorrent as lt
import time

ses = lt.session()
ses.listen_on(6881, 6891)
params = {
    'save_path': '/home/philip/Downloads/',
    'storage_mode': lt.storage_mode_t(2)}
link = "magnet:?xt=urn:btih:56e8b1c88b7133fafef4a8a925116eaa36862a21&dn=test.txt&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337"
handle = lt.add_magnet_uri(ses, link, params)
ses.start_dht()

print('downloading metadata...')
while (not handle.has_metadata()):
    time.sleep(1)
print('got metadata, starting torrent download...')
while (handle.status().state != lt.torrent_status.seeding):
    s = handle.status()
    state_str = ['queued', 'checking', 'downloading metadata', \
                'downloading', 'finished', 'seeding', 'allocating']
    print('%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s %.3' % \
                (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \
                s.num_peers, state_str[s.state], s.total_download/1000000))
    time.sleep(5)
arvidn commented 1 year ago

webtorrent support is not enabled by default (yet). you need to pass in --b2-args=webtorrent=on to that setup.py command line

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

uyjulian commented 1 year ago

hoge

kingomarnajjar commented 7 months ago

WE WANT WEBTORRENT BY DEFAULT! (pretty pretty please :) @arvidn is a sex machine for creating and maintaining Libtorrent. It is a GOD made library. To change the world of torrenting, moving to webtorrent enabled by default completely changes the internet and the world. I don't think its possible to exaggerate the impact of the world doing browser peer to peer file sharing. It's one of those sounds boring but insanely impactful when you look back at it

Please be the king of torrents and make this god like feature a reality for the masses by default.

kingomarnajjar commented 7 months ago

I have a few friends and business customers that will use this to push 1-10tb of torrents a day. This becomes business crucial and we want to help be your hand oh github repo masters. #7283 #7281 #7283 #6789 giphy

QuixThe2nd commented 7 months ago

My friend linked me this issue. I'm interested in using WebTorrent as a CDN layer, if WebTorrent support gets enabled by default. I'm able to help with development and test in production.

5831 #4123 #223

kingomarnajjar commented 7 months ago

This projects going to the moooon! 🚀🚀🚀 This is the next big thing since the #chiablockchain 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥 Broooo we can't miss out on this emergent system. FIRREEEE!

Kief5555 commented 7 months ago

Yeah, the feature awesome. I love libtorrent and I would also love the support for webtorrent 🙏🏻🙏🏻🙏🏻

Jhingun1 commented 7 months ago

I hope this gets implemented soon 🙏🥲

petterreinholdtsen commented 6 months ago

So do I. I have been waiting for this for years, to get it into the VLC bittorrent plugin in Debian.