Make sure to read the readme.txt, as you will
NEED to do a tiny bit of hacking (1 step actually). Please disregard
the included SQL in the readme.txt, use this line instead:
Code:
ALTER TABLE `torrents` ADD `grabs`
varchar(11) default '0';
Note that this does not work for newly
crawled torrents from Ibitzy! You will need do a mass scrape or let
the user update the torrent!There are two extra pages
included with this package: a premade details.php which includes the
'downloads' piece, and new.php. Simply copy over the existing
details.php, and move the new.php to your T-XORE ROOT, DO NOT COPY
OVER ADM/NEW.PHP!! It can be used like mininovas 'newest torrents
added today!', just
do not
overwrite your adm/new.php with the provided
new.php!!!!
Enjoy and rate it please
1=bad,
5=great!
Attachment:
File comment:
Zipped! scrape
addon.zip [9.36 KB] Downloaded 6
times
Attachment:
File comment:
7zipped! scrape
addon.7z [6.21 KB] Downloaded 1
time Here is your SCRAPER.php (replace
everything!)
Code:
<?
/*
Project : T-Xore version
0.0.4 released on
06/2006 By Bogaa
This piece of software is free to use by anyone and may be
redistributed
and modified by anyone
in any way. We can't be held liable for
damage
or copyright infringement
claims. Read the documentation!
Bogaa's Homepage :
http://www.meganova.org
Project
Homepage : http://www.devnova.org
*/
$id =
$_GET['id'];
Header("Location:
details.php?id=$id");
require_once "config.php";
connect
($dbhost, $dbuser, $dbpass, $database);
// Check if a comment
was posted
if ($_POST['submitted'] == '')
{
// The
details query
$result = mysql_query("SELECT * FROM torrents LEFT
JOIN categories ON torrents.subcat = categories.subid WHERE
torrents.id ='".strip_tags(trim($_GET['id']))."'") or die
(mysql_error());
$count = mysql_num_rows($result);
if ($count
== 0)
{
stheader('Torrent Not Found');
echo '<div
id="page-error" class="fade-FF0000" style="padding:.2em"><br
/><h1>Torrent not
found!</div>';
footer();
die;
}
while($row=
mysql_fetch_array($result))
{
$tracker =
$row['tracker'];
$hash =
$row['hash'];
///echo 'hash get :'.$hash.'';
//
replace udp shit with http://
$tracker =
str_replace('udp://', 'http://', $tracker);
$trackers
= bin2hex(trim($tracker));
$url
= pack("H*", $trackers);
$nurl
= pack("H*", $trackers);
//torrent data gives only
announce so this must be changed to scrape
$url =
str_replace('announce', 'scrape', $url) .
'?info_hash=';
for($i=0;$i<40;$i=$i+2)
{
$url .=
'%'.substr($hash, $i, 2);
}
//$scrape =
@file_get_contents($url); //no cURL
$scrape =
@getcontent($url); //cURL
// getting data
from tracker
scrape.php
@preg_match('#completei(.+?)e10#',$scrape,$complete);
@preg_match('#incompletei(.+?)e#',$scrape,$incomplete);
@preg_match('#downloadedi(.+?)e10#',$scrape,$grabs);
$update
= date('YmdHis');
if
($complete=="")
{
$complete[1]='-1';
}
if
($incomplete=="")
{
$incomplete[1]='-1';
}
if
($grabs=="")
{
$grabs[1]='-1';
}
echo '<p>Tracker:
'.$tracker.' | Seeders:'.$complete[1].' | Leechers:
'.$incomplete[1].' | Downloaded:
'.$grabs[1].'</p>';
@mysql_query("UPDATE torrents SET seeds
= '$complete[1]', peers = '$incomplete[1]', grabs = '$grabs[1]',
updated= '$update' WHERE hash = '$hash' LIMIT 1") or
die(mysql_error());
}
}
?>
**Current
"bug"**
Some torrents may not update the downloaded stat, either
because its hasnt been downloaded enough, it may be dead, or the
tracker may be loaded.
WHOSE THE MAN?! WHOSE THE MAN!