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

Webtorrent extention for Libtorrent with python #259

Closed
vkefallinos opened this issue Feb 4, 2015 · 3 comments
Closed

Webtorrent extention for Libtorrent with python #259

vkefallinos opened this issue Feb 4, 2015 · 3 comments

Comments

@vkefallinos
Copy link

@vkefallinos vkefallinos commented Feb 4, 2015

I want to add webtorrent extention to rasterbar libtorrent. I couldn't find any instructions to create a generic webtorrent extention.
I am thinking something like proxying and modifying webrtc requests to fool libtorrent and treat them as normal connections. This way it could interoperate. Node is not good for really low end hardware like raspberry pi 1.
Can you help? Or resources would help too..
Great Work by the way...!!
Thanks

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 11, 2015

@vkefallinos Thanks for opening this issue. As soon as I have the time, I'll write up a BEP to explain the changes needed to support WebTorrent. There aren't many. You can have a look at the bittorrent-tracker module in the meantime to see how websocket trackers work.

See: #168

@feross feross closed this Apr 11, 2015
@onny

This comment has been minimized.

Copy link

@onny onny commented Aug 31, 2017

Sorry for posting in this old and closed issue @feross but I have a small question regarding webtorrent and python.
I have this small test python script here https://git.project-insanity.org/snippets/22 which should connect to a websocket tracker and ask for peers. I always get the response, that my infohash is wrong.
I'm not sure how to do this hex to binary encoding etc., especially in Python. Do you have any clue?
Thank you,
Jonas

@Zer0C001

This comment has been minimized.

Copy link

@Zer0C001 Zer0C001 commented Nov 19, 2017

@onny : You need to use unhexlify and json:
import json,binascii
.....
after pl = '{"numwant":10 ... :

pl=json.loads(pl)
pl['info_hash']=binascii.unhexlify(infohash).decode('unicode-escape')
pl=json.dumps(pl)

result:
$ python3 pywbt2.py
> {"numwant": 10, "uploaded": 0, "downloaded": 0, "left": "null", "event": "started", "action": "announce", "info_hash": "\b\u00ad\u00a5\u00a7\u00a6\u0018:\u00ae\u001e\t\u00d81\u00dfgH\u00d5f\tZ\u0010", "peer_id": "-WW0098-CR5i5FXgxCXl"}
< {"complete":13,"incomplete":1,"action":"announce","interval":120,"info_hash":"\b­¥§¦\u0018:®\u001e\tØ1ßgHÕf\tZ\u0010"}

Without the double json conversion you get "Unexpected token" errors.

@lock lock bot locked as resolved and limited conversation to collaborators May 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.