1
I wonder how I can get the seeders and leechers file .torrent using the API Bitsnoop. How can I be making the request?
1
I wonder how I can get the seeders and leechers file .torrent using the API Bitsnoop. How can I be making the request?
2
You must make a request GET
, and send as parameter the key hash
, the value of HASH of the archive .torrent, and specify the format json
.
error_reporting(E_STRICT);
include 'Torrent.php';
function obterSeedLeech($hash){
$apiURL = "http://bitsnoop.com/api/trackers.php?hash={$hash}&json=1";
$resultado = file_get_contents($apiURL);
return $resultado;
}
$torrent = new Torrent('tails-i386-1.2.3.torrent'); // Especifique o arquivo torrent aqui
$torrentHash = $torrent->hash_info(); // HASH do arquivo torrent
$SeedsLeechs = obterSeedLeech($torrentHash);
$SeedsLeechs = json_decode($SeedsLeechs);
$seeds = $leechs = 0;
if (is_array($SeedsLeechs)){
foreach($SeedsLeechs as $anuncios){
$leechs += $anuncios->NUM_LEECHERS;
$seeds += $anuncios->NUM_SEEDERS;
echo "Anúncio: ". $anuncios->ANNOUNCE. " Seed: ". $anuncios->NUM_SEEDERS. " Leech: ". $anuncios->NUM_LEECHERS. "<br>";
}
} else {
// Fazer algo aqui caso não seja retornado as informações da hash.
}
//echo "Total de seeds: ". $seeds. "<br>";
//echo "Total de leechs: ". $leechs. "<br>";
Hello, how should I call the API in my code ??
@Lucascarezia I did not understand, just change in the code above where you have "HASH AQUI"
for hash of your torrent, to get it, just use the $torrent->hash_info()
, look here
Yes, I did, but it didn’t work, could you show me an example of how your ??
@Lucascarezia Look at that example.
A list of Trackers has appeared informing Seed and Leeecher of each Tracker, now how do I add it all up ??
Thank you, solved the problem.
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
The way the question is, it can be closed because it is too wide, what is doubt exactly? Which part are you struggling with?
– stderr
I rephrased my question.
– Lucas Caresia
I edited the question, but even so it is vague, in the future try to post some code already made, post what you have tried, what difficulties you are having to do this, anyway, try to post a question with a minimum of effort, so there will be more possibilities to receive answers that meet your goal.
– stderr
If possible make a Tour by the site, see also the topics of this page to understand how the site works. =)
– stderr