sçuçu
sçuçu

Reputation: 3070

Building magnet uri from torrent hash

I am reviewing torrent search apis, json ones. I am currently examining strike api and torrent project api.

In the strike api the responses includes magnet uris, but in the torrent project api no magnet uris delivered but torrent_hash is delivered.

In one of the alternative npm modules I plan to use I need magnet uri to download files. And torrent project api is the one that seems more suitable for me.

As I have made a little research on magnet uri scheme and examined the return values from the strike api, that include both torrent hash and magnet uri of the same file, I see the torrent hash is included in a magnet uri as xt (exact topic) parameter including urn as xt=urn:btih:<torrent_hash_here>, for BitTorrent downloads.

However, other info than torrent hash also included in a magnet uri, trackers in tr parameters. These are more general tracker adresses.

Is it possible to correctly build the magnet uri of a file from its torrent hash?

If yes, how, by just string concatenation? What about the trackers (values of tr parameters in magnet uri), where to find them for adding to string built as magnet uri?

Is that actually necessary to download files? Can files be downloaded by use of torrent hashes without magnet uris? If yes, how?

an example magnet uri key from a strike api response:

magnet_uri":"magnet:?xt=urn:btih:B425907E5755031BDA4A8D1B6DCCACA97DA14C04&dn=Arch+Linux+2015.01.01+%28x86%2Fx64%29&tr=udp:\/\/open.demonii.com:1337&tr=udp:\/\/tracker.coppersurfer.tk:6969&tr=udp:\/\/tracker.leechers-paradise.org:6969&tr=udp:\/\/exodus.desync.com:6969

an example response from the torrent project api:

{"total_found":"563690","1":{"title":"Force, Marie et al. -Ask Me Why.epub","category":"ebooks","seeds":5,"leechs":0,"torrent_size":1005221,"torrent_hash":"63a4ca7a1f7796e5ecdc09bac1f8bc69daf3f7eb"}}

Upvotes: 0

Views: 1432

Answers (1)

the8472
the8472

Reputation: 43125

Is it possible to correctly build the magnet uri of a file from its torrent hash?

yes

Can files be downloaded by use of torrent hashes without magnet uris?

yes

Upvotes: -4

Related Questions