So I wanted to work on a new Java project that converts magnet URIs into .torrent files, however I can't find a way to do that, basically I broke a magnet URI into pieces :
The used URI :
magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.example4.com%3A80&tr=udp%3A%2F%2Ftracker.example5.com%3A80&tr=udp%3A%2F%2Ftracker.example3.com%3A6969&tr=udp%3A%2F%2Ftracker.example2.com%3A80&tr=udp%3A%2F%2Ftracker.example1.com%3A1337
The breaking down :
magnet:?
xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36
dn=Leaves+of+Grass+by+Walt+Whitman.epub
tr=udp%3A%2F%2Ftracker.example4.com%3A80
tr=udp%3A%2F%2Ftracker.example5.com%3A80
tr=udp%3A%2F%2Ftracker.example3.com%3A6969
tr=udp%3A%2F%2Ftracker.example2.com%3A80
tr=udp%3A%2F%2Ftracker.example1.com%3A1337
from what I gathered using this link, The torrent file contains the files , lengths and paths of the required files but I can't seem to get that from the magnet URI.
Thanks in advance.
It's impossible to recreate the .torrent file from the magnet link alone.
The way torrent clients gets the .torrent file from a magnet link is:
BEP9 - Extension for Peers to Send Metadata Files.
not really clean but..
Runtime.getRuntime().exec(new String[]{"cmd", "/c","start firefox " + mag});
// needs firefox and a default torrent handler. // mag = magnet string