P2P:Programming:Trackers:Multiscrape
From Depthstrike
Contents |
General Information
- Multiscraping is done primarily to reduce the overhead generated by multiple scrape requests that amount to less than the tracker's full torrent scrape.
- Whenever information on more than one torrent is required and the number of torrents which information is required on is less than about 90% of the tracker's total torrent list, multiscraping is preferred.
- Individual trackers may outright deny global scraping for bandwidth concerns.
Request Construction
- The following request will ask the specified tracker about all torrents from first_hash through to nth_hash.
- Any torrents the tracker does not know about will not be included in the response.
http://<tracker-address>:<port>/scrape<.php>?info_hash=<first_hash>&info_hash=<second_hash>......&info_hash=<nth_hash>
Response Contruction
- A scrape response will still be returned in such a way as to comply with the BitTorrent Specification Scrape Convention with the difference that the response will include information for each supplied info_hash that the tracker has information on
files <first_hash> complete = <number of seeds> downloaded = <number of times the file has been completed> incomplete = <number of downloaders> name = <internal name of the torrent (optional)> <second_hash> complete = <number of seeds> downloaded = <number of times the file has been completed> incomplete = <number of downloaders> name = <internal name of the torrent (optional)> ..... <nth_hash> complete = <number of seeds> downloaded = <number of times the file has been completed> incomplete = <number of downloaders> name = <internal name of the torrent (optional)>
Known Tracker Packages with Multiscrape
Paramater Parser
- This is the code to give PHP tracker developers options for scraping multiple torrents in a single request.
- The following code generates a $queryparams array that gives all the paramaters included in the request, even if multiple paramaters have the same name.
$queryinput = explode('&', $_SERVER['QUERY_STRING']);
$queryparams = array();
$count = count($queryinput);
for($i=0; $i<$count; $i++)
{
$tempparams = explode('=', $queryinput[$i]);
$queryparams[$tempparams[0]][] = urldecode($tempparams[1]);
sort($queryparams[$tempparams[0]]);
}
- Another code option (provided by DeHackEd)
foreach (explode("&", $_SERVER["QUERY_STRING"]) as $item) { if (substr($item, 0, 10) == "info_hash=") { ..... }} //
- Another code option (provided by TheColonel)
$count = preg_match_all("/info_hash=([^&?]*)/", $_SERVER['QUERY_STRING'], $matches);
Back to P2P - Back to P2P Programming - Back to Trackers - Back To Main - Depthstrike Home
