0

While using this script my tracker only update seeds & leechers from http tracker only 1st Tracker of my torrent.

print("<tr><td class='desc'><b>" .T_("Torrent Stats"). ": </b></td><td valign='top' class='lista'>");
        $seeders1 = $leechers1 = $downloaded1 = null;

        $tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
        while ($trow = mysql_fetch_assoc($tres)) {
            $ann = $trow["url"];
            $tracker = explode("/", $ann);
            $path = array_pop($tracker);
            $oldpath = $path;
            $path = preg_replace("/^announce/", "scrape", $path);
            $tracker = implode("/", $tracker)."/".$path;

            if ($oldpath == $path) {
                continue; // Scrape not supported, ignored
            }

            // TPB's tracker is dead. Use openbittorrent instead
            if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker)) {
                $tracker = "http://tracker.openbittorrent.com/scrape";
            }

            $stats = torrent_scrape_url($tracker, $row["info_hash"]);
            if ($stats['seeds'] != -1) {
                $seeders1 += $stats['seeds'];
                $leechers1 += $stats['peers'];
                $downloaded1 += $stats['downloaded'];
                SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");
            } else {
                SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

            }
        }

Please correct It I haven't been able to solve this trouble. In first code I think trouble is here

$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
Howli
  • 12,291
  • 19
  • 47
  • 72

2 Answers2

0
$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=".$id.";");

This should work if $id is a php variable

0riginal
  • 137
  • 1
  • 11
  • Using this it will only scrape the 1st url in announce & if its HTTP only then If Its UDP then it won't scrape.I want to use something like this so it can scrape the whole trackers in torrent $res = mysql_query("SELECT id, info_hash FROM torrents WHERE external = 'yes' ORDER BY added DESC LIMIT 25"); $TorrentInfo = ParseTorrent("$site_config[torrent_dir]/$row[id].torrent"); $ann = $TorrentInfo[0]; $annlist = array(); if ($TorrentInfo[6]) { foreach ($TorrentInfo[6] as $ann) { $annlist[] = $ann[0]; } } else $annlist = array($ann); – user3541450 May 28 '14 at 11:54
0

The problem is that you are sending a http-scrape to an UDP-tracker.
UDP-tracker uses an entirely diffrent protocol: http://www.bittorrent.org/beps/bep_0015.html

Encombe
  • 2,003
  • 1
  • 17
  • 26