Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a magnet uri in Scala to download a file
    text
    copied!<p>I'm wanting to include some bittorrent features in my Scala app. I want to use magnet links exclusively if I can for their ease of use. The issue is I'd like to use a prebuilt library like <a href="https://github.com/turn/ttorrent" rel="nofollow">ttorrent</a>. But, I found these libs don't use magnet links, they use the metainfo or the torrent file itself. </p> <p>So I figure my first step is to take the magnet link and build a metainfo object myself. I understand the makeup of the magnet link pretty well and can parse it into the parameters. <strong>I'm just not quite sure how to use the magnet parameters. I don't know what to do with them.</strong> </p> <p>Here's just a test magnet link I found on PB to work with:</p> <pre><code>magnet:?xt=urn:btih:ad11eb1a0aeed57116225fb341dc61883c22aeba&amp;dn=Rise.of.the.Guardians.2012.TS.NEW.SOURCE.x264.AAC-UNiQUE&amp;tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&amp;tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&amp;tr=udp%3A%2F%2Ftracker.istole.it%3A6969&amp;tr=udp%3A%2F%2Ftracker.ccc.de%3A80 </code></pre> <p>After parsing it I get:</p> <pre><code>xt=urn:btih:ad11eb1a0aeed57116225fb341dc61883c22aeba dn=Rise.of.the.Guardians.2012.TS.NEW.SOURCE.x264.AAC-UNiQUE tr=udp://tracker.openbittorrent.com:80 tr=udp://tracker.publicbt.com:80 tr=udp://tracker.istole.it:6969 tr=udp://tracker.ccc.de:80 </code></pre> <p>Simple enough. Now I haven't used hashes too much, but I'm pretty sure I can't get any info from it directly. My only guess is that I may have to contact one of the trackers to get the metainfo. I'm not sure though.</p> <p>[fyi] The torrenting will only be used for legal sharing, to share app data and app files between users of the app. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload