Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
UDP Scrape not work...
You don't have permission for this action!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2023-03-10 06:48:31
Hi i try scrape udp tracker, but not work showing "Time Out"
2023-03-10 22:02:11
Try this in torrents-details.php:
				//===| Scrape External Torrents
if ($row["external"]=='yes')
{
print ("<td width='160' align='right' valign='top'><table><tr>");
if ($scrape =='1')
{
print("<td class='f-border p-title' width='150' valign='middle'>
<div style='margin-top:5px; margin-bottom:10px; font:bold 16px Times' align='center'><font color='#FF2000'>".T_("EXTERNAL_TORRENT")."</font></div>");

//===| Scrape HTTP
$seeders1 = $leechers1 = $downloaded1 = null;
$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
while ($trow = mysqli_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; }
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 (isset($stats['seeds']) != -1)
{
$seeders1 += (isset($stats['seeds']));
$leechers1 += (isset($stats['peers']));
$downloaded1 += (isset($stats['downloaded']));
}
}
//===| End Scrape HTTP

//===| Scrape UDP
$resu = SQL_Query_exec("SELECT id, info_hash FROM torrents WHERE external = 'yes' AND id = $id");
while ($rowu = mysqli_fetch_array($resu))
{
$TorrentInfo = ParseTorrent("$site_config[torrent_dir]/$rowu[id].torrent");
$ann = $TorrentInfo[0];
$annlist = array();

if ($TorrentInfo[6])
{
foreach ($TorrentInfo[6] as $ann)
{
$annlist[] = $ann[0];
}
}
else
$annlist = array($ann);

$seeders = $leechers = $downloaded = null;
foreach ($annlist as $ann)
{
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = str_replace("announce", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;

if ($oldpath == $path)
{
continue;
}
if ($openbittorrent_done)
continue;

if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker))
{
$tracker = "http://tracker.openbittorrent.com/scrape";
$openbittorrent_done = 1;
}
if(preg_match('%udp://([^:/]*)(?::([0-9]*))?(?:/)?%si', $tracker))
{
$udp=true;
try
{
$timeout = 5;
$udp= new udptscraper($timeout);
$stats=$udp->scrape($tracker,$rowu["info_hash"]);
foreach ($stats as $idu=>$scrape)
{
$seeders += $scrape['seeders'];
$leechers += $scrape['leechers'];
$downloaded += $scrape['completed'];
}
}
catch(ScraperException $e)
{
$e->isConnectionError();
}
}
else
{
$stats = torrent_scrape_url($tracker, $rowu["info_hash"]);
}

if (isset($stats['seeds']) != -1)
{
$seeders += (isset($stats['seeds']));
$leechers += (isset($stats['peers']));
$downloaded += (isset($stats['downloaded']));

$totseed = $seeders1 + $seeders;
$totleech = $leechers1 + $leechers;
$totcomp = $downloaded1 + $downloaded;

SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $totseed, `leechers` = $totleech, `times_completed` = $totcomp WHERE `url` = ".sqlesc($ann)." AND `torrent` = $rowu[id]");
}
else
{
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $rowu[id]");
}
}

if ($seeders !== null)
{
SQL_Query_exec("UPDATE torrents SET leechers = '".$totleech."', seeders = '".$totseed."', times_completed = '".$totcomp."', last_action = '".get_date_time()."', visible = 'yes' WHERE id = '".$rowu['id']."'");
}
else
{
SQL_Query_exec("UPDATE torrents SET leechers = '0', seeders = '0', last_action = '".get_date_time()."' WHERE id='".$rowu['id']."'");
}
}
//===| End Scrape UDP

if ($seeders !== null) {
print ("<div style='margin-bottom:5px; margin-left:20px'><b>".T_("LIVE_STATS")."</b>: </div>");
print ("<div style='margin-left:20px'>".T_("SEEDERS").": <font color='#24AA24'>".$totseed."</font></div>");
print ("<div style='margin-left:20px'>".T_("LEECHERS").": <font color='#D70000'>".$totleech."</font></div>");
print ("<div style='margin-left:20px'>".T_("COMPLETED").": <font color='#0080FF'>".$totcomp."</font></div>");
} else {
print ("<div style='margin-top:10px; margin-bottom:5px' align='center'><b>".T_("LIVE_STATS")."</b>: </div>");
print ("<div style='font:italic 14px Times' align='center'><font color='#D70000'>".T_("TRACKERS_OFFLINE")."!</font></div>");
}
print ("<div style='margin-top:10px; margin-bottom:10px' align='center'>
<a href=\"torrents-details.php?id=".$id."\"><input type=\"submit\" name=\"submit\" value=\"".T_("SUBMIT")."\"></a>
</div>");
print ("</td>");
}
else
{
                       if (get_user_class() >= 5){
print ("<td class='f-border p-title' width='150' valign='middle' align='center'>
<div style='margin-top:5px; margin-bottom:10px; font:bold 16px Times' align='center'><font color='#D70000'>".T_("EXTERNAL_TORRENT")."</font></div>
<div style='margin-bottom:5px; font:normal 12px Times' align='center'>".T_("UPDATE_STATS")."</div></div>
<div style='margin-top:5px; margin-bottom:10px' align='center'>
<img src='images/load.gif' border='0' width='32' height='32'><br />
<form action='torrents-details.php?id=$id&scrape=1' method='post'><input type=\"submit\" name=\"submit\" value=\"".T_("UPDATE")."\" /></form>
</div>
</td>");
}
                 }
print ("</tr></table></td>");
  }
//===| End Scrape External Torrents

2023-03-11 06:30:29
not work
2023-03-11 11:24:37
Which exact UDP trackers you have specified in your torrent file?



udp://tracker.openbittorrent.com:6969/announce

udp://9.rarbg.to:2710/announce

udp://9.rarbg.me:2780/announce

udp://9.rarbg.to:2730/announce

udp://tracker.opentrackr.org:1337

http://p4p.arenabg.com:1337/announce

udp://tracker.torrent.eu.org:451/announce

udp://tracker.tiny-vps.com:6969/announce

udp://open.stealth.si:80/announce


Download that torrent: Aquaman.2018.1080p.HDRip.x264 - ExYuSubs  

There you have that statistic:




www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2023-03-11 14:38:55
Not work
2023-03-11 16:26:39

<?
class ScraperException extends Exception
{
   private $connectionerror;
   public function __construct($message, $code = 0, $connectionerror = false)
   {
       $this->connectionerror = $connectionerror;
       parent::__construct($message, $code);
   }
   public function isConnectionError()
   {
       return ($this->connectionerror);
   }
}
abstract class tscraper
{
   protected $timeout;
   public function __construct($timeout = 2)
   {
       $this->timeout = $timeout;
   }
}
class udptscraper extends tscraper
{
.........


Im reworking this today. Hang in there.


Array ( [fe91262c62f9877f0d79c6cf87b0fb904ae80e80] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => fe91262c62f9877f0d79c6cf87b0fb904ae80e80 ) )


UPDATE


$timeout = 2;
$scraper = new ScrapeTorrent($timeout);

$urls = array(
   'udp://tracker.opentrackr.org:1337/announce',
   'udp://tracker.pomf.se:80/announce',
   'udp://tracker.sylphix.com:6969/announce',
   'udp://tracker.theoks.net:6969/announce',
   'udp://tracker.torrent.eu.org:451/announce',
   'udp://tracker1.bt.moack.co.kr:80/announce',
   'udp://tracker2.dler.com:80/announce',
   'udp://tracker6.lelux.fi:6969/announce'
);

foreach ($urls as $url) {
   try {
       $ret = $scraper->scrape($url, 'd158701550334ff31273e1f3788bdb3c1f10a3ed');
       print_r($ret);
   } catch (ScraperException $e) {
       echo 'Error: ' . $e->getMessage() . PHP_EOL;
       if ($e->isConnectionError()) {
           echo 'Connection error: ' . $e->getCode() . PHP_EOL;
       }
   }
}



Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) No connection response.Connection error: 1No connection response.Connection error: 1Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Could not open UDP connection: 0 - php_network_getaddresses: getaddrinfo for tracker6.lelux.fi failed: Name does not resolveConnection error: 1


--

The class works fine. It can use improvements (like a multi-announce array I showed), other than that, im going to add parallel support for each url request, so its faster (only if enabled, code will check). It doesnt have to be a fixed array, it can be read from $site_config, or a database table (preferred).
Last edited by STorrents2020 on 2023-03-11 17:36:05
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728