Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable WebTorrent in Python #7333

Open
ghost opened this issue Mar 1, 2023 · 14 comments
Open

Enable WebTorrent in Python #7333

ghost opened this issue Mar 1, 2023 · 14 comments

Comments

@ghost
Copy link

ghost commented Mar 1, 2023

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
Copy link
Owner

arvidn commented Mar 1, 2023

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
Copy link
Author

ghost commented Mar 1, 2023

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
Copy link

uyjulian commented Mar 3, 2023

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
Copy link
Author

ghost commented Mar 4, 2023

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
Copy link
Owner

arvidn commented Mar 5, 2023

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

@stale
Copy link

stale bot commented Aug 12, 2023

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
Copy link

hoge

@kingomarnajjar
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@Jhingun1
Copy link

I hope this gets implemented soon 🙏🥲

@petterreinholdtsen
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants