Tweeting a torrent

A friend asked what the best way to tweet a Torrent would be. I thought the obvious thing would be to tweet the magnet link, but those tend to be too long to fit in 140 characters and Twitter’s URL shortener doesn’t work on magnet: links.

Why are magnet links so long any way? Here’s a working magnet link to a copy of wikipedia, an 11GB file named enwiki-20140707-pages-articles.xml.bz2:

magnet:?xt=urn:btih:e18b8cce7d9cb2726f5f40dcb857111ec573cad4&tr=http%3A%2F%2Facademictorrents.com%2Fannounce.php&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce

That’s awfully wordy, let’s break it down and futz it to be readable.

magnet:?
xt=urn:btih:e18b8cce7d9cb2726f5f40dcb857111ec573cad4
tr=http://academictorrents.com/announce.php
tr=udp://tracker.publicbt.com:80/announce
tr=udp://tracker.openbittorrent.com:80/announce

The important thing is the hash in the xt parameter. That uniquely identifies the content and it can be addressed as such via DHT discovery. Those tr parameters just list trackers, which you don’t strictly need thanks to trackerless torrents. Indeed, the following 61 character URL works fine in Transmission.

magnet:?xt=urn:btih:e18b8cce7d9cb2726f5f40dcb857111ec573cad4

It’s not very convenient though. It lacks a filename, file size, etc. Startup time is (theoretically) slower as we have to discover data. I also don’t know how much of a performance impact removing the tracker list has, if any.

Of course one could add some of the missing bits back. “dn” is the displayed filename, “xl” is the file size.

The xt parameter is a bit subtle; there are at least 9 different hash algorithms that can be specified. BTIH seems to work well for torrents.