arcticbb

It is currently Thu May 31, 2007 12:26 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Please make sure to backup if you have to modify your SQL tables!

Legend:
(Admin) = For Admin Only!
(User) = For Users/Public Only!



Post new topic Reply to topic  [ 1 post ] 

How good is this script?
1
2
3
4
5
You may select 1 option

View results
Author Message
 Post subject: New scrape method (grabs downloaded# amount!) (Admin & User)
PostPosted: Wed May 30, 2007 2:48 am 
Offline
x_x

Joined: Tue Apr 24, 2007 2:47 pm
Posts: 39
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 Very Happy
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! Very Happy Very Happy

_________________
AKNOVA.INFO


Venetian Snares - Hajnal / Szerencsétlen


Report this post
 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
arcticSilver1 template by phrostwave

powered by phpBB © 2002, 2006 phpBB Group
[ Time : 0.121s | 11 Queries | GZIP : On ]