3

So I am wanting to build a basic torrent tracker/indexing software with a setup so that when a torrent is uploaded the peer count can be returned from the trackers within the torrent. I've seen a lot about scraping torrents but I've not seen how you would specifically go about echoing the peer counts, completed downloads or average download speed. I myself am only really interested in receiving the seed and leecher counts individually.

I found some scripts that support UDP and HTTP scraping on github and forked them and added a script that can be used to process the actual .torrent file itself the Github Repository

I'm not a wizard at any language in particular so could someone give me a rough template of what would be needed with the scripts included? An example torrent tracker software I'd use as a base would be something along the lines of PeerTracker

I noticed that here there are seed and leecher and completed variables in httpscraper.php line 79.

$torrents = array();
    foreach($infohash as $hash){
        $ehash = pack('H*', $hash);
        if (isset($arr_scrape_data['files'][$ehash])){
            $torrents[$hash] = array('infohash'=>$hash,
                                     'seeders'=>(int) $arr_scrape_data['files'][$ehash]['complete'],
                                            'completed'=>(int) $arr_scrape_data['files'][$ehash]['downloaded'],
                                            'leechers'=>(int) $arr_scrape_data['files'][$ehash]['incomplete']
                                            );
        } else {
        $torrents[$hash] = false;
    }
}

So how would I go about echoing those? I can setup the tracker and hash variables in the script but I'm not sure what to use to echo those parameters into a document.

nik_m
  • 11,825
  • 4
  • 43
  • 57

0 Answers0