UDP Tracker Scraping 1 script working other Not

2019-09-07 20:22发布

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");

2条回答
仙女界的扛把子
2楼-- · 2019-09-07 20:48

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

查看更多
欢心
3楼-- · 2019-09-07 21:00
$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

查看更多
登录 后发表回答