Vladimir Shevelyov
Vladimir Shevelyov

Reputation: 111

Scrape multitracker torrent php

I need to get the amount of seeders and leechers of the given .torrent. Let's say this one (it is a really popular torrent at the moment and it definitely has tons of seeders and leechers)

I Bdecoded the torrent file and got the announces:

$announces = array("udp://tracker.opentrackr.org:1337/announce",
"udp://tracker.coppersurfer.tk:6969/announce",
"udp://tracker.openbittorrent.com:80/announce",
"udp://glotorrents.pw:6969/announce",
"udp://tracker.leechers-paradise.org:6969/announce",
"udp://zer0day.ch:1337/announce",
"udp://9.rarbg.me:2710/announce",
"udp://tracker.trackerfix.com:80/announce",
"udp://eddie4.nl:6969/announce",
"udp://9.rarbg.to:2710/announce");

as well as hash_info = "0ddf5052c1c580a129598186e05c494f45727881";

Then I replace "udp" with "http" and "announce" with "scrape" and send the curl get request with the torrent hash like this:

foreach($announces as $announce){
$scrape_url = str_ireplace( array( 'udp://', '/announce' ), array( 'http://', '/scrape' ), $announce).pack('H*',"0ddf5052c1c580a129598186e05c494f45727881");
echo file_get_contents($scrape_url)."<hr>";
}

But the only I get is "Connection refused", "Operation timed out" and "HTTP request failed! HTTP/1.1 404 Not Found". What am I doing wrong? Curl gives the same result btw.

Upvotes: 2

Views: 842

Answers (1)

Encombe
Encombe

Reputation: 2090

The problem is that you try to do http-scrapes on UDP trackers.
To scrape UDP trackers you need to follow the protocol described in:
BEP15 -UDP Tracker Protocol for BitTorrent

Upvotes: 2

Related Questions