How to create torrent file from magnet link using java?
up vote
0
down vote
favorite
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.
java bittorrent torrent magnet-uri
add a comment |
up vote
0
down vote
favorite
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.
java bittorrent torrent magnet-uri
@MarsAtomic SHA-1 "encrypted"?
– Kayaman
Feb 19 at 20:13
1
@MarsAtomic no, not really. Are you saying he should reverse a SHA-1 hash? And are you saying that without any hint of sarcasm?
– Kayaman
Feb 19 at 20:18
I think so, I have found that the hashsums are SHA-1 encoded
– Tarek Mohamed
Feb 19 at 20:22
1
Well, now you'll find out that hashes are one-way, meaning you can't "decode" them.
– Kayaman
Feb 19 at 20:25
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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.
java bittorrent torrent magnet-uri
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.
java bittorrent torrent magnet-uri
java bittorrent torrent magnet-uri
edited Feb 19 at 20:04
the_storyteller
1,1811118
1,1811118
asked Feb 19 at 19:57
Tarek Mohamed
1617
1617
@MarsAtomic SHA-1 "encrypted"?
– Kayaman
Feb 19 at 20:13
1
@MarsAtomic no, not really. Are you saying he should reverse a SHA-1 hash? And are you saying that without any hint of sarcasm?
– Kayaman
Feb 19 at 20:18
I think so, I have found that the hashsums are SHA-1 encoded
– Tarek Mohamed
Feb 19 at 20:22
1
Well, now you'll find out that hashes are one-way, meaning you can't "decode" them.
– Kayaman
Feb 19 at 20:25
add a comment |
@MarsAtomic SHA-1 "encrypted"?
– Kayaman
Feb 19 at 20:13
1
@MarsAtomic no, not really. Are you saying he should reverse a SHA-1 hash? And are you saying that without any hint of sarcasm?
– Kayaman
Feb 19 at 20:18
I think so, I have found that the hashsums are SHA-1 encoded
– Tarek Mohamed
Feb 19 at 20:22
1
Well, now you'll find out that hashes are one-way, meaning you can't "decode" them.
– Kayaman
Feb 19 at 20:25
@MarsAtomic SHA-1 "encrypted"?
– Kayaman
Feb 19 at 20:13
@MarsAtomic SHA-1 "encrypted"?
– Kayaman
Feb 19 at 20:13
1
1
@MarsAtomic no, not really. Are you saying he should reverse a SHA-1 hash? And are you saying that without any hint of sarcasm?
– Kayaman
Feb 19 at 20:18
@MarsAtomic no, not really. Are you saying he should reverse a SHA-1 hash? And are you saying that without any hint of sarcasm?
– Kayaman
Feb 19 at 20:18
I think so, I have found that the hashsums are SHA-1 encoded
– Tarek Mohamed
Feb 19 at 20:22
I think so, I have found that the hashsums are SHA-1 encoded
– Tarek Mohamed
Feb 19 at 20:22
1
1
Well, now you'll find out that hashes are one-way, meaning you can't "decode" them.
– Kayaman
Feb 19 at 20:25
Well, now you'll find out that hashes are one-way, meaning you can't "decode" them.
– Kayaman
Feb 19 at 20:25
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
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:
- Get a peer list from the tracker(s) and/or from the DHT.
- Connect to peers and download the .torrent metadata using
BEP9 - Extension for Peers to Send Metadata Files.
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
add a comment |
up vote
0
down vote
not really clean but..
Runtime.getRuntime().exec(new String{"cmd", "/c","start firefox " + mag});
// needs firefox and a default torrent handler.
// mag = magnet string
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
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:
- Get a peer list from the tracker(s) and/or from the DHT.
- Connect to peers and download the .torrent metadata using
BEP9 - Extension for Peers to Send Metadata Files.
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
add a comment |
up vote
1
down vote
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:
- Get a peer list from the tracker(s) and/or from the DHT.
- Connect to peers and download the .torrent metadata using
BEP9 - Extension for Peers to Send Metadata Files.
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
add a comment |
up vote
1
down vote
up vote
1
down vote
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:
- Get a peer list from the tracker(s) and/or from the DHT.
- Connect to peers and download the .torrent metadata using
BEP9 - Extension for Peers to Send Metadata Files.
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:
- Get a peer list from the tracker(s) and/or from the DHT.
- Connect to peers and download the .torrent metadata using
BEP9 - Extension for Peers to Send Metadata Files.
answered Feb 19 at 20:30
Encombe
1,4631919
1,4631919
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
add a comment |
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Thank you for your comment, okay so,let me rephrase my question, using Java , how can I connect to peers and get the meta data if I have the magnet link ?
– Tarek Mohamed
Feb 20 at 9:34
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
Implementing the above means implementing a almost complete bittorrent client - i.e. it's most probably easier to find a way to use a existing, already finished client.
– Encombe
Feb 20 at 11:39
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
I have searched for already made torrent clients ( like this one ) , but it is too complicated for me to get the meta data grabbing part.
– Tarek Mohamed
Feb 20 at 12:52
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
It is complicated and there is no way around that. As a alternative, you maybe can use a online service: btcache.me btso.pw itorrents.org magnet2torrent.me torrage.info thetorrent.org magnet2torrent.com
– Encombe
Feb 20 at 15:22
add a comment |
up vote
0
down vote
not really clean but..
Runtime.getRuntime().exec(new String{"cmd", "/c","start firefox " + mag});
// needs firefox and a default torrent handler.
// mag = magnet string
add a comment |
up vote
0
down vote
not really clean but..
Runtime.getRuntime().exec(new String{"cmd", "/c","start firefox " + mag});
// needs firefox and a default torrent handler.
// mag = magnet string
add a comment |
up vote
0
down vote
up vote
0
down vote
not really clean but..
Runtime.getRuntime().exec(new String{"cmd", "/c","start firefox " + mag});
// needs firefox and a default torrent handler.
// mag = magnet string
not really clean but..
Runtime.getRuntime().exec(new String{"cmd", "/c","start firefox " + mag});
// needs firefox and a default torrent handler.
// mag = magnet string
answered Nov 10 at 21:26
Mikhail Zerafa
1
1
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48873300%2fhow-to-create-torrent-file-from-magnet-link-using-java%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@MarsAtomic SHA-1 "encrypted"?
– Kayaman
Feb 19 at 20:13
1
@MarsAtomic no, not really. Are you saying he should reverse a SHA-1 hash? And are you saying that without any hint of sarcasm?
– Kayaman
Feb 19 at 20:18
I think so, I have found that the hashsums are SHA-1 encoded
– Tarek Mohamed
Feb 19 at 20:22
1
Well, now you'll find out that hashes are one-way, meaning you can't "decode" them.
– Kayaman
Feb 19 at 20:25