UDP Tracker Scraping 1脚本工作其他不

时间:2014-05-28 11:35:11

标签: php udp scrape bittorrent

使用此脚本时,我的跟踪器仅更新种子和来自http跟踪器的leechers只有第一追踪器的我的洪流。

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

            }
        }

请更正我无法解决这个问题。 在第一段代码中,我认为麻烦就在这里

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

2 个答案:

答案 0 :(得分:0)

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

如果$ id是php变量

,这应该有效

答案 1 :(得分:0)

问题是您正在向UDP跟踪器发送http - scrape UDP跟踪器使用完全不同的协议:http://www.bittorrent.org/beps/bep_0015.html