medariox / scrapeer

Essential PHP library that scrapes HTTP(S) and UDP trackers for torrent information.
93 stars 29 forks source link

Strange problem #11

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi i have try to run a basic example on my computer & unfortunately i obtain a blank page without any error

On my debian server it's working ( but no in my pc ) sorry for my bad english

`<?php

require_once 'scraper.php';

$scraper = new Scrapeer\Scraper();

$tracker = array('udp://public.popcorn-tracker.org:6969/announce',
    'http://182.176.139.129:6969/announce',
    'http://5.79.83.193:2710/announce',
    'http://91.218.230.81:6969/announce',
    'http://bt01.nnm-club.cc:2710/announce',
    'http://atrack.pow7.com/announce');

$hash = array( '0e1b1a2f5be209e1157c148faaf8afd3a3aa3824' );

$info = $scraper->scrape( $hash, $tracker );

print_r( $info );`

Possible to help me , thx very much

medariox commented 7 years ago

"Blank page" means that all the trackers failed aka no result to show.

What you are looking for is error logging, have a look at the Advanced usage examples - Error logging. That should solve your question.

For your example:

require_once 'scraper.php';

$scraper = new Scrapeer\Scraper();

$tracker = array('udp://public.popcorn-tracker.org:6969/announce',
    'http://182.176.139.129:6969/announce',
    'http://5.79.83.193:2710/announce',
    'http://91.218.230.81:6969/announce',
    'http://bt01.nnm-club.cc:2710/announce',
    'http://atrack.pow7.com/announce');

$hash = array( '0e1b1a2f5be209e1157c148faaf8afd3a3aa3824' );

$info = $scraper->scrape( $hash, $tracker );

print_r( $info );`

// Check if we have any errors.
if ( $scraper->has_errors() ) {
    // Get the errors and print them.
    print_r( $scraper->get_errors() );
}
ghost commented 7 years ago

Ok thx also i have try to add multiple trackers (10) , but in the response i have only the stats of the first tracker ...

i am forced to do this dirty code

require 'scraper.php';

$trackers = array('udp://tracker.opentrackr.org:1337/announce','udp://tracker.leechers-paradise.org:6969','udp://tracker.internetwarriors.net:1337','udp://tracker.zer0day.to:1337/announce');

$scraper = new Scrapeer\Scraper();

$hash = 'A37279895DEEC8419B9FA3D076B1C036A31F1AC1';

// Init var
$seeders = 0;
$completed = 0;
$leechers = 0;

foreach($trackers as $tracker) {
    $info = $scraper->scrape(array($hash),array($tracker),1,1);
    $seeders += $info[$hash]['seeders'];
    $completed += $info[$hash]['completed'];
    $leechers += $info[$hash]['leechers'];
}

echo 'seeders : '.$seeders.' completed : '.$completed.' leechers : '.$leechers;
medariox commented 7 years ago

By design Scrapeer only returns the stats from the first available tracker and stops.

medariox commented 7 years ago

Closing this now. If you have any other questions, please open a new issue.