Bravo List
Register
Go Back   > Bravo List > Source Code > Active Trackers > Torrent Trader
Reply
Thread Tools
  #1  
Old 15th June 2023, 08:51
crowni's Avatar
crowni crowni is offline
Senior Member
 
Join Date: Apr 2009
Bulgaria
Posts: 129
Default Mega Scrape
HTML Code:
ALTER TABLE torrents ADD updated enum('0','1') NOT NULL default '0';
</div>

HTML Code:
<?php  require_once("backend/functions.php"); require_once("backend/BDecode.php"); require_once("backend/parse.php"); dbconn(false);  set_time_limit(0);  $interval = 800; // Rescrape torrents every x seconds. (Default: 2 days)  $ts = gmtime() - $interval; $res = mysql_query("SELECT id, info_hash FROM torrents WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts) ORDER BY last_action DESC LIMIT 1"); echo "SELECT id, info_hash FROM torrents WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts) ORDER BY last_action DESC LIMIT 1"; $count = get_row_count("torrents", "WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts)");  while ($row = mysql_fetch_array($res)) {         $tres = mysql_query("SELECT `url` FROM `announce` WHERE `torrent` = $row[id]");         $annlist = array();         while ($trow = mysql_fetch_array($tres)) {                 $annlist[] = $trow["url"];         }         $seeders = $leechers = $downloaded = null;         echo "Info_Hash: $row[info_hash] ";         foreach ($annlist as $ann) {                 $tracker = explode("/", $ann);                 $path = array_pop($tracker);                 $oldpath = $path;                 $path = preg_replace("/^announce/", "scrape", $path);                 $tracker = implode("/", $tracker)."/".$path;                 if ($oldpath == $path) {                         echo " <B>$ann</B>: Scrape not supported. ";                         continue;                 }                  $stats = torrent_scrape_url($tracker, $row["info_hash"]);                 if ($stats['seeds'] != -1) {                         $seeders += $stats['seeds'];                         $leechers += $stats['peers'];                         $downloaded += $stats['downloaded'];                         echo " <B>$ann</B> ";                         echo "Seeders: $stats[seeds] ";                         echo "Leechers: $stats[peers] ";                         echo "Downloaded: $stats[downloaded] ";                         mysql_query("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");                 } else {                         echo " <B>$ann</B>: Tracker timeout. ";                         mysql_query("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");                 }         }          if ($seeders !== null){                 echo " <B>Totals:</B> ";                 echo "Seeders: $seeders ";                 echo"Leechers: $leechers ";                 echo "Completed: $downloaded  ";                  mysql_query("UPDATE torrents SET leechers='".$leechers."', seeders='".$seeders."',times_completed='".$downloaded."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");         }else{                 echo "All trackers timed out. ";                 mysql_query("UPDATE torrents SET last_action= '".get_date_time()."' WHERE id='".$row['id']."'");         } } ?>      <script language="JavaScript">  //Refresh page script- By Brett Taylor (glutnix@yahoo.com.au) //Modified by Dynamic Drive for NS4, NS6+ //Visit http://www.dynamicdrive.com for this script  //configure refresh interval (in seconds) <? if ($count) echo "var countDownInterval=6;"; else echo "var countDownInterval=900;"; // No torrents to scrape, refresh in 15mins ?> //configure width of displayed text, in px (applicable only in NS4) var c_reloadwidth=200  </script>   <ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>  <script>  var countDownTime=countDownInterval+1; function countDown(){ countDownTime--; if (countDownTime <=0){ countDownTime=countDownInterval; clearTimeout(counter) window.location.reload() return } if (document.all) //if IE 4+ document.all.countDownText.innerText = countDownTime+" "; else if (document.getElementById) //else if NS6+ document.getElementById("countDownText").innerHTML=countDownTime+" " else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN document.c_reload.document.c_reload2.document.write('Next <a href="java script:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds') document.c_reload.document.c_reload2.document.close() } counter=setTimeout("countDown()", 1000); }  function startit(){ if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN document.write('Next <a href="java script:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds') countDown() }  if (document.all||document.getElementById) startit() else window.onload=startit  </script>
Attached Files
File Type: php mega_scrape.php (3.6 KB, 12 views)
File Type: php mega-start.php (574 Bytes, 8 views)
Reply With Quote
  #2  
Old 15th June 2023, 19:43
mogo mogo is offline
Senior Member
 
Join Date: Jun 2020
P2P
Posts: 97
Default
Quote:
Originally Posted by crowni View Post
HTML Code:
ALTER TABLE torrents ADD updated enum('0','1') NOT NULL default '0';
</div>

HTML Code:
<?php  require_once("backend/functions.php"); require_once("backend/BDecode.php"); require_once("backend/parse.php"); dbconn(false);  set_time_limit(0);  $interval = 800; // Rescrape torrents every x seconds. (Default: 2 days)  $ts = gmtime() - $interval; $res = mysql_query("SELECT id, info_hash FROM torrents WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts) ORDER BY last_action DESC LIMIT 1"); echo "SELECT id, info_hash FROM torrents WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts) ORDER BY last_action DESC LIMIT 1"; $count = get_row_count("torrents", "WHERE external = 'yes' AND last_action <= FROM_UNIXTIME($ts)");  while ($row = mysql_fetch_array($res)) {         $tres = mysql_query("SELECT `url` FROM `announce` WHERE `torrent` = $row[id]");         $annlist = array();         while ($trow = mysql_fetch_array($tres)) {                 $annlist[] = $trow["url"];         }         $seeders = $leechers = $downloaded = null;         echo "Info_Hash: $row[info_hash] ";         foreach ($annlist as $ann) {                 $tracker = explode("/", $ann);                 $path = array_pop($tracker);                 $oldpath = $path;                 $path = preg_replace("/^announce/", "scrape", $path);                 $tracker = implode("/", $tracker)."/".$path;                 if ($oldpath == $path) {                         echo " <B>$ann</B>: Scrape not supported. ";                         continue;                 }                  $stats = torrent_scrape_url($tracker, $row["info_hash"]);                 if ($stats['seeds'] != -1) {                         $seeders += $stats['seeds'];                         $leechers += $stats['peers'];                         $downloaded += $stats['downloaded'];                         echo " <B>$ann</B> ";                         echo "Seeders: $stats[seeds] ";                         echo "Leechers: $stats[peers] ";                         echo "Downloaded: $stats[downloaded] ";                         mysql_query("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");                 } else {                         echo " <B>$ann</B>: Tracker timeout. ";                         mysql_query("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $row[id]");                 }         }          if ($seeders !== null){                 echo " <B>Totals:</B> ";                 echo "Seeders: $seeders ";                 echo"Leechers: $leechers ";                 echo "Completed: $downloaded  ";                  mysql_query("UPDATE torrents SET leechers='".$leechers."', seeders='".$seeders."',times_completed='".$downloaded."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'");         }else{                 echo "All trackers timed out. ";                 mysql_query("UPDATE torrents SET last_action= '".get_date_time()."' WHERE id='".$row['id']."'");         } } ?>      <script language="JavaScript">  //Refresh page script- By Brett Taylor (glutnix@yahoo.com.au) //Modified by Dynamic Drive for NS4, NS6+ //Visit http://www.dynamicdrive.com for this script  //configure refresh interval (in seconds) <? if ($count) echo "var countDownInterval=6;"; else echo "var countDownInterval=900;"; // No torrents to scrape, refresh in 15mins ?> //configure width of displayed text, in px (applicable only in NS4) var c_reloadwidth=200  </script>   <ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>  <script>  var countDownTime=countDownInterval+1; function countDown(){ countDownTime--; if (countDownTime <=0){ countDownTime=countDownInterval; clearTimeout(counter) window.__cpLocation.reload() return } if (document.all) //if IE 4+ document.all.countDownText.innerText = countDownTime+" "; else if (document.getElementById) //else if NS6+ document.getElementById("countDownText").innerHTML=countDownTime+" " else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN document.c_reload.document.c_reload2.document.write('Next <a href="java script:window.__cpLocation.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds') document.c_reload.document.c_reload2.document.close() } counter=setTimeout("countDown()", 1000); }  function startit(){ if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN document.write('Next <a href="java script:window.__cpLocation.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds') countDown() }  if (document.all||document.getElementById) startit() else window.onload=startit  </script>
The idea of mega scrape is not very good :)
Reply With Quote
  #3  
Old 16th June 2023, 07:11
crowni's Avatar
crowni crowni is offline
Senior Member
 
Join Date: Apr 2009
Bulgaria
Posts: 129
Default re
I know it puts a lot of load on the server
Reply With Quote
  #4  
Old 16th June 2023, 18:42
szaby szaby is offline
Senior Member
 
Join Date: Jul 2008
Posts: 34
Default
I think it's stupid to burden a private tracker with this.
Reply With Quote
  #5  
Old 16th June 2023, 19:44
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
a better way to do this is via cron and you can schedule it at different interval of times
__________________
Need HELP!? I can install:

  1. Server/VPS (Debian,CentOS,Ubuntu,Fedora, FreeBSD) Optimization and ... + Modules
  2. Webserver Windows/Linux (Apache/Lighttpd/Nginx/Mysql/PhpMyAdmin/SSL) Optimization and ... + Modules
  3. Seedbox Windows/Linux (uTorrent,rTorrent,libTorrent,ruTorrent) + Modules
  4. Multiple source code engines
  5. Linux Server Administration (security, cryptography/encryption, proxy, load balancer, custom ddos firewall)
Reply With Quote
  #6  
Old 17th June 2023, 00:23
szaby szaby is offline
Senior Member
 
Join Date: Jul 2008
Posts: 34
Default
Quote:
Originally Posted by DND View Post
a better way to do this is via cron and you can schedule it at different interval of times

but does it make sense on a private server?
Reply With Quote
  #7  
Old 17th June 2023, 08:50
DND DND is offline
VIP
 
Join Date: Dec 2008
Posts: 1,242
Default
TT is used for semi-private, public sites
__________________
Need HELP!? I can install:

  1. Server/VPS (Debian,CentOS,Ubuntu,Fedora, FreeBSD) Optimization and ... + Modules
  2. Webserver Windows/Linux (Apache/Lighttpd/Nginx/Mysql/PhpMyAdmin/SSL) Optimization and ... + Modules
  3. Seedbox Windows/Linux (uTorrent,rTorrent,libTorrent,ruTorrent) + Modules
  4. Multiple source code engines
  5. Linux Server Administration (security, cryptography/encryption, proxy, load balancer, custom ddos firewall)
Reply With Quote
  #8  
Old 27th June 2023, 12:14
JohnHasher JohnHasher is offline
Coder
 
Join Date: Apr 2020
P2P
Posts: 62
Default
its better to use cronjob to update all old torrents in the system, it will do a nice job in background

Bump: i already have this feature in my tt
__________________
i do custom mods in xbtitfm and torrenttrader for $$, PM me for details.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 13:58. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.