Anyone creating extsearch engines?

randac56

Member
May 25, 2018
915
0
16
Anyone around here creating extsearch engines? I'd be will to send an invite to the private tracker. Also anyone consider adding publichd to the public tracker section?
 

simur612

Member
May 25, 2018
879
0
16
Anyone around here creating extsearch engines? I'd be will to send an invite to the private tracker
In theory, i can do this. In practice, i can't support this engine, because I don't want use this tracker. I.e. this engine will work until the first changes in the design of your tracker.
Also anyone consider adding publichd to the public tracker section?
Try to add issue about that to the projects page.
 

randac56

Member
May 25, 2018
915
0
16
I understand the idea of not being responsible to keep it updated. The website is done from the xbtitfm site template and I modified the engine from https://code.google.com/p/rutorrent/source/browse/trunk/plugins/extsearch/engines/PuntoTorrent.php since it uses the same website template but, it doesn't find anything when searching. I think the problem is from this section of code but, I can't make heads or tails of it.
Code:
$res = preg_match_all('/<tr class="torrent_\d"><td class="table_categ_icon"><a.*onmouseover="return overlib\(\'(?P<cat>.*)\'\);".*<\/a><\/td><td class="table_name">.*'.
'<a href="\/details.php\?id=(?P<id>\d+)" class="torrent_name_link".*title="(?P<name>.*)">.*'.
'<td class="table_added">(?P<date>.*)<\/td><td class="table_size">(?P<size>.*)<\/td>.*'.
'<td class="table_seeders">(?P<seeds>.*)<\/td><td class="table_leechers">(?P<leech>.*)<\/td>/siU', $cli->results, $matches);
It looks like this is parsing the source of the webpage search results but, I am a little lost.
Is there any logging function built into the engine? I can't see how the website is responding and getting no results.
 

simur612

Member
May 25, 2018
879
0
16
Is there any logging function built into the engine? I can't see how the website is responding and getting no results.
Use toLog( string ) and check /tmp/errors.log or
use error_log( string ) and check web-server's log
 

randac56

Member
May 25, 2018
915
0
16
Well I am still having issues figuring this engine out. I have tried to add a debug line to the $cli variable but, the file gets created but, it is empty. If someone could look at the code and see if I've made a simple error.

This file has been created as MySite.php and placed in the engines directory.
Code:
<?php

class MySiteEngine extends commonEngine
{
public $defaults = array( "public"=>false, "page_size"=>30, "cookies"=>"mysite.com|pass=XXX;uid=XXX" );
public $categories = array(
'all'=>'&category=0',
'720p'=>"&category=1",
'1080p'=>"&category=2",
'Remux'=>"&category=3",
'HD-DVD'=>"&category=11",
'HD-TV'=>"&category=15",
'Anime'=>"&category=5",
);

public function action($what,$cat,&$ret,$limit,$useGlobalCats)
{
$added = 0;
$url = 'http://mysite.com';

if($useGlobalCats)
$categories = array( 'all'=>'&category=0' );
else
$categories = &$this->categories;
if(!array_key_exists($cat,$categories))
$cat = $categories['all'];
else
$cat = $categories[$cat];

for($pg = 1; $pg<10; $pg++)
{
$cli = $this->fetch( $url.'/index.php?page=torrents&active='.$cat.'&search='.$what.'&&order=2&by=1&pages='.$pg );
file_put_contents("urlfile.txt", $cli, FILE_APPEND); //LOG CLI VAR

if( ($cli==false) ) break;

$res = preg_match_all('`<td align="center".*<img src="http://mysite.com/style/bluehover/images/categories/.*" border="0" alt="(?P<cat>[^"]*)".*'.
'<a href="index.php\?page=torrent-details&amp;id=(?P<id>[^"]*)" title="View details: [^"]*">(?P<name>.*)</a>.*'.
'href="download\.php(?P<link>[^"]*)">.*'.
'<td align="center" class="header" width="85">(?P<date>.*)</td>.*'.
'<td align="center" class="header" width="30">(?P<seeds>.*)</td>.*'.
'<td align="center" class="header" width="30">(?P<leech>.*)</td>.*'.
'<td align="center" class="header" width="55"><b>(?P<size>.*)</b></td>'.
'`siU', $cli->results, $matches);

if($res)
{
for($i=0; $i<$res; $i++)
{
$link = $url."/download.php".$matches["link"][$i];
if(!array_key_exists($link,$ret))
{
$item = $this->getNewEntry();
$item["cat"] = self::removeTags($matches["cat"][$i]);
$item["desc"] = $url."/index.php?page=torrent-details&id=".$matches["id"][$i];
$item["name"] = self::removeTags($matches["name"][$i]);
$item["size"] = self::formatSize(trim(str_replace("<br>"," ",$matches["size"][$i])));
$item["time"] = strtotime(self::removeTags(trim(str_replace("<br />"," ",str_replace("/",".",$matches["date"][$i])))));
$item["seeds"] = intval(trim(self::removeTags($matches["seeds"][$i])));
$item["peers"] = intval(trim(self::removeTags($matches["leech"][$i])));
$ret[$link] = $item;
$added++;
if($added>=$limit)
return;
}
}
}
else
break;
}
}
}

This is the link that should be performed by the $cli variable.
Code:
http://mysite.com/index.php?page=torrents&active=0&category=1&search=iron&&order=2&by=1

Here is the code that should be searched for in the page source.

Code:


<td align="center" width="85" class="lista" style="white-space:wrap; text-align:center;">10/10/2012</td>
<td align="center" width="30" class="lista" style="text-align: center;"><a href="index.php?page=peers&amp;id=cf50e741392b28ab86b111e03c2df18bd69a7aea" title="Click here to view peers details">2</a></td>
<td align="center" width="30" class="lista" style="text-align: center;"><a href="index.php?page=peers&amp;id=cf50e741392b28ab86b111e03c2df18bd69a7aea" title="Click here to view peers details">0</a></td>
<td align="center" width="30" class="lista" style="text-align: center;"><a href="index.php?page=torrent_history&amp;id=cf50e741392b28ab86b111e03c2df18bd69a7aea" title="History - Tetsuo.The.Iron.Man.1989.720p.BluRay.x264-CiNEFiLE">5</a></td>


<td align="center" width="30" class="lista"><a href='index.php?page=userdetails&id=000'><span style='color:#DFFFFF'>someuser</a></td>
 

simur612

Member
May 25, 2018
879
0
16
$cli is a object. You can't log it by such way. Try to read something about php. And about PCRE.