0

I know that using code <a href="mailto:john.smith@gmail.com">John Smith</a> I can call email clients to send emails to who I want.

Now, how can I call torrent client softwares to download a torrent?

Mohammad Naji
  • 5,372
  • 10
  • 54
  • 79
  • I think this can be of help. http://stackoverflow.com/questions/12479570/given-a-torrent-file-how-do-i-generate-a-magnet-link-in-python I think you'll need to do this server side. The above link is for Python. I'm sure you could find an equivalent for whichever language your server is in. – keithxm23 Oct 25 '12 at 14:27
  • My god, @keithxm23 I thought that there should be a standard for all those softwares. OK, thank you. So what does `href="magnet:http://link"` will do? Someone commented that I had to use `magnet` but deleted it shortly after the comment. – Mohammad Naji Oct 25 '12 at 14:33

2 Answers2

2

Technically, you are not calling an email client when a user clicks on such a link. Instead, the client launches the application registered for handling that type of URI. The technical name for the mailto part of the URI is the scheme.

What you actually want is the Magnet URI Scheme.

To generate a BitTorrent magnet URI, you need to extract the info section of the bencoded .torrent file contents, as described in the BitTorrent protocol specification. Generate the SHA-1 hash of the data (this is called the "infohash"), then hex-encode that hash. You can also include a tr parameter to declare where the tracker is. e.g.

magnet:?xt=urn:btih:<your_hex_encoded_sha1_hash>&tr=http://urlto/announce

For further reading, I would suggest How do BitTorrent magnet links work?.

Community
  • 1
  • 1
RB.
  • 36,301
  • 12
  • 91
  • 131
-1

you could use a magnet link

(this is a example for a file with 0bytes)

   magnet:?xt=urn:ed2k:31D6CFE0D16AE931B73C59D7E0C089C0
&xl=0&dn=zero_len.fil
&xt=urn:bitprint:3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ
.LWPNACQDBZRYXW3VHJVCJ64QBZNGHOHHHZWCLNQ
&xt=urn:md5:D41D8CD98F00B204E9800998ECF8427E

then you can personalize your magnetic link to managing the downloading for the file that you want to be downloaded.

source http://en.wikipedia.org/wiki/Magnet_URI_scheme#Technical_description

damoiser
  • 6,058
  • 3
  • 40
  • 66