parse-torrent icon indicating copy to clipboard operation
parse-torrent copied to clipboard

BitTorrent v2 Support

Open leoherzog opened this issue 3 years ago • 11 comments

What version of this package are you using? 9.1.0

What problem do you want to solve? I want to be able to detect the SHA-256 v2 hash of a v2 Torrent that is parsed with parse-torrent. This also means detecting btmh in addition to btih in Magnet links.

What do you think is the correct solution to this problem? Adding a infoHashv2 key (or similar) to the resulting object that is generated by parse-torrent

Are you willing to submit a pull request to implement this change? I will try and learn how parse-torrent works and see what I can do

leoherzog avatar Nov 15 '20 20:11 leoherzog

It looks like we'd need to update magnet-uri upstream, as well as find an equivalent to simple-sha1 for SHA256?

leoherzog avatar Nov 17 '20 15:11 leoherzog

Of course, @feross already beat us to it :laughing:

https://github.com/feross/simple-sha256

leoherzog avatar Nov 17 '20 15:11 leoherzog

We'd accept a PR that added support for this. @leoherzog Are you interested in sending a PR? I just noticed that there's a PR for this already sent to magnet-uri, though it needs some work: https://github.com/webtorrent/magnet-uri/pull/43

feross avatar Nov 17 '20 22:11 feross

@feross What things need work still in webtorrent/magnet-uri#43 from your perspective?

leoherzog avatar Mar 09 '21 20:03 leoherzog

webtorrent/magnet-uri#43 has been merged, and magnet-uri correctly passes in an infoHashv2 key to parse-torrent. The remaining scope for this issue (and future pull request) would be to add support for Torrent files, as Magnet URLs are now covered.

leoherzog avatar May 12 '21 17:05 leoherzog

How is the status here?

B1773rm4n avatar Apr 12 '22 06:04 B1773rm4n

v2 .torrent file support added?

mepanko91 avatar Apr 14 '22 10:04 mepanko91

I haven't had much time to look at or improve this, but feel free to contribute to the pull request

https://github.com/webtorrent/parse-torrent/pull/91

leoherzog avatar Apr 14 '22 14:04 leoherzog

I haven't had much time to look at or improve this, but feel free to contribute to the pull request

#91

Ok. Cool

mepanko91 avatar Apr 14 '22 16:04 mepanko91

parse-torrent 11.0.14 throws an error on v2-only torrents

Error: Torrent is missing required field: info.pieces

edit:

related: https://github.com/webtorrent/node-bencode/pull/94

milahu avatar Aug 30 '23 20:08 milahu

When this project was converted to an ESM package (https://github.com/webtorrent/parse-torrent/releases/tag/v10.0.0), my pull request #91 became pretty irrelevant. My work here would have to be thrown out and rewritten to add compatibility with v2 torrents and I don't have time to dive in and learn what would need to be done... but if someone's willing to take that on, that would be nice. Don't expect to hear much from the maintainers though. It was awaiting review for over a year and never heard anything regarding feedback or pull request status, then they moved forward with converting to ESM instead.

https://github.com/webtorrent/parse-torrent/pull/91#issuecomment-1194491669

leoherzog avatar Aug 30 '23 21:08 leoherzog