alexcoe / remote-torrent-adder

Automatically exported from code.google.com/p/remote-torrent-adder
0 stars 2 forks source link

Supporting tracker-less torrents #132

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of Chrome are you using? On what operating system?
Version 39.0.2171.95 (64-bit)

What client (version?) are you connecting to? Are you using SSL?
rTorrent 0.9.4/0.13.4

What steps will reproduce the problem?
1. Browse to https://oldpiratebay.org/search.php?q=ubuntu
2. Click a magnet link
3. A popup indicates the magnet was added successfully, however rTorrent does 
not load a job

What is the expected output? What do you see instead?
Expect rTorrent to load a job

What causes this output?
Torrents on https://oldpiratebay.org do not contain a tracker within their URL, 
instead they contain links similar to below:

magnet:?xt=urn:btih:febd9a2cb755ec82e6e7a015a8dc497fde9dd507&dn=Ubuntu+Ultimate+
Edition+1.4+DVD&xl=2083522692&dl=2083522692

While rTorrent includes capability for automatically adding re-trackers 
(trackers to be added upon job creation), these don't seem to take effect when 
the job is loaded from a magnet, and contains no trackers in the magnet url. 
The same behavior can be observed when a job is loaded by copying the magnet 
link URL and pasting it into r(u)Torrent. As such, it is not an issue with 
Remote Torrent Adder (RTA) in particular, though the problem can be fixed from 
this end.

To remedy the issue myself, I've added a line of code to RTA which appends 
"
    &tr=udp%3A//tracker.openbittorrent.com%3A80
    &tr=udp%3A//tracker.publicbt.com%3A80
"
to the end of magnet links immediately before being sent to the server.

While this situation works well for me in the meantime (It was frustrating not 
being able to use oldpiratebay+rutorrent easily before), I think it would be a 
valuable feature if users could specify retrackers to add to magnet links from 
within RTA's options menu. In instances where trackers go down or sites are 
abandoned completely, this could provide users a way to quickly switch to using 
live trackers within their browser with relative ease.

On an unrelated note, I've made a donation to your project as a show of thanks 
for the work you've done so far. I don't intend for it to be construed as 
either payment or incentive for this feature, it's just because this project is 
well designed and maintained.

Thanks again,
Hiphop

Original issue reported on code.google.com by hiphop03...@gmail.com on 12 Jan 2015 at 12:37

GoogleCodeExporter commented 9 years ago
first off, thank you for the donation! i appreciate it a lot.

secondly, thanks a lot for the detailed issue report and suggestion.

i understand the issue, but if magnet links don't work for you unless they 
explicitly state a tracker, that's almost certainly a configuration problem in 
rtorrent. you may wish to review your configuration (compare last box here: 
https://wiki.archlinux.org/index.php/RTorrent#Additional_settings)

if you don't specify a tracker 
(http://en.wikipedia.org/wiki/Magnet_URI_scheme#Address_tracker_.28tr.29) in a 
magnet url like you've encountered, the torrent client is supposed to find the 
torrent's metadata using the always-present info hash of the magnet link and 
looking it up in DHT (http://en.wikipedia.org/wiki/Mainline_DHT). the &tr= 
parameter is just a crutch used by many sites to speed up the lookup, but it 
represents a fallback to the old, not-decentralized tracker paradigm.

that being said, i get that it serves a purpose. however, i also think that by 
this day and age, torrent clients should be able to do that sort of work on 
their own, and i don't think that it should be one of the tasks of RTA to 
manipulate links like that. furthermore, the broad assumption that any link you 
click on will have its info hash on the trackers you specify (e.g., 
publicbt/openbittorrent) may be inaccurate and you'd have to keep fixing the 
crutches you create.

given your situation, if the above rtorrent configuration doesn't fix the 
issue, i'd suggest using a small userscript (chrome supports them out of the 
box, but they're easier to write/maintain using the extension tampermonkey) 
that detects and manipulates magnet links on pages. that way, RTA will pick up 
magnet links the way your configuration would expect them.

this one did the job for me:

// ==UserScript==
// @name       magnet tracker appender
// @version    1
// @match      http*://*/*
// @require    http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==

var myTrackers = [
    "udp://tracker.openbittorrent.com:80",
    "udp://tracker.publicbt.com:80"
    ];

var links = document.querySelectorAll("a[href^=magnet\\:]");

for(var i in links) {
    for(var t in myTrackers) {
        links[i].href = links[i].href + "&tr=" + encodeURIComponent(myTrackers[t]);
    }
}

Original comment by jul...@gmail.com on 12 Jan 2015 at 1:20