mainURL = "isohunt.com"; $this->altURL = "isohunt.com"; $this->mainTitle = "isoHunt"; $this->engineName = "isoHunt"; $this->author = "kboy"; $this->version = "1.05-tfb"; $this->updateURL = "http://www.torrentflux.com/forum/index.php/topic,878.0.html"; $this->Initialize($cfg); } //---------------------------------------------------------------- // Function to Make the Request (overriding base) function makeRequest($request) { return parent::makeRequest($request, true); } //---------------------------------------------------------------- // Function to get Latest.. function getLatest() { $request = "/latest.php?mode=bt"; if (!empty($this->pg)) { $request .= "&pg=" . $this->pg; } if ($this->makeRequest($request)) { return $this->parseResponse(true); } else { return $this->msg; } } //---------------------------------------------------------------- // Function to perform Search. function performSearch($searchTerm) { // This is what isohunt is looking for in a request. // http://isohunt.com/torrents.php?ihq=test&ext=&op=and // create the request string. $searchTerm = str_replace(" ", "+", $searchTerm); $request = "/torrents?ihq=".$searchTerm; //$request .= "&ext=&op=and"; if (!empty($this->pg)) { $request .= "&ihs1=18&iho1=d&iht=-1&ihp=" . $this->pg; } // make the request if successful call the parse routine. if ($this->makeRequest($request)) { return $this->parseResponse(false); } else { return $this->msg; } } //---------------------------------------------------------------- // Function to parse the response. function parseResponse($latest = true) { $output = $this->tableHeader(); $thing = $this->htmlPage; // Strip out those Nasty Iframes. $thing = preg_replace("//i",'',$thing); // We got a response so display it. // Chop the front end off. if ($latest) { $start = strpos($thing, "New torrents on isoHunt"); } else { $start = strpos($thing, "isoHunt Rank"); } $thing = substr($thing, $start, strlen($thing) - $start); if ($latest) { $end = strrpos($thing, "adclick"); } else { $end = strrpos($thing, "ยป"); } $tmpList = $thing; //echo $tmpList; if (strpos($tmpList,"/download/") || strpos($tmpList,"torrent_details")) { // ok so now we have the listing. $tmpListArr = explode("",$tmpList); array_pop($tmpListArr); $bg = $this->cfg["bgLight"]; foreach($tmpListArr as $key =>$value) { //echo $value; $buildLine = true; if (strpos($value,"/download/") || strpos($value,"torrent_details")) { $ts = new isoHunt($value,$latest); // Determine if we should build this output if (is_int(array_search($ts->CatName,$this->catFilter))) { $buildLine = false; } if ($this->hideSeedless == "yes") { if($ts->Seeds == "N/A" || $ts->Seeds == "0") { $buildLine = false; } } if (!empty($ts->torrentFile) && $buildLine) { $output .= trim($ts->BuildOutput($bg)); // ok switch colors. if ($bg == $this->cfg["bgLight"]) { $bg = $this->cfg["bgDark"]; } else { $bg = $this->cfg["bgLight"]; } } } } // set thing to end of this table. $thing = substr($thing,strpos($thing,"")); if (!is_integer(strpos($thing,"name=ihLogin"))) { $thing = ""; } } $output .= ""; // is there paging at the bottom? if (strpos($this->htmlPage, "") != false) { // Yes, then lets grab it and display it! ;) $thing = substr($this->htmlPage,strpos($this->htmlPage,"
")+strlen("
")); $pages = substr($thing,0,strpos($thing,"
")); $pages = str_replace("  ",'',strip_tags($pages,"")); $tmpPageArr = explode("",$pages); array_pop($tmpPageArr); $pagesout = ''; foreach($tmpPageArr as $key => $value) { $value .= "  "; $tmpVal = substr($value,strpos($value,"/torrents/"),strpos($value,"\>")-1); $pgNum = substr($tmpVal,strpos($tmpVal,"ihp=")+strlen("ihp=")); $pagesout .= str_replace($tmpVal,"XXXURLXXX".$pgNum,$value); } if(strpos($this->curRequest,"LATEST")) { $pages = str_replace("XXXURLXXX",$this->searchURL()."&LATEST=1&pg=",$pagesout); } else { $pages = str_replace("XXXURLXXX",$this->searchURL()."&searchterm=".$_REQUEST["searchterm"]."&pg=",$pagesout); } $pages = strip_tags($pages,""); $output .= "
".$pages."
"; } return $output; } } // This is a worker class that takes in a row in a table and parses it. class isoHunt { var $torrentName = ""; var $torrentDisplayName = ""; var $torrentFile = ""; var $torrentSize = ""; var $torrentStatus = ""; var $CatId = ""; var $CatName = ""; var $fileCount = ""; var $Seeds = ""; var $Peers = ""; var $Data = ""; var $dateAdded = ""; var $dwnldCount = ""; function isoHunt( $htmlLine , $latest = true) { if (strlen($htmlLine) > 0) { $this->Data = $htmlLine; // Fix messed up end td's once in a while. $htmlLine = preg_replace("/<(.)*1ff8(.)*/td>/i",'',$htmlLine); // Chunck up the row into columns. $tmpListArr = explode("",$htmlLine); array_pop($tmpListArr); //Age Type Torrent Names MB F S L D if(count($tmpListArr) > 5) { if ($latest) { // Latest Request // if(strpos($tmpListArr["3"],"[DL]")) { //$tmpListArr["1"] = $this->cleanLine($tmpListArr["1"]); // Age $this->CatName = $this->cleanLine($tmpListArr["2"]); // Type $tmpStr = $tmpListArr["3"]; // TorrentName and Download Link // move to the [DL] area. and remove [REL] line $tmpStr = substr($tmpStr,strpos($tmpStr,"[DL]")+strlen("[DL]"), strpos($tmpStr,"[REL]")); $tmpStr = substr($tmpStr,strpos($tmpStr,"href=\"")+strlen("href=\"")); // Download Link $this->torrentFile = "http://isohunt.com".substr($tmpStr,0,strpos($tmpStr,"\"")); $tmpStr = substr($tmpStr,strpos($tmpStr,"title=\"")+strlen("title=\"")); $tmpStr = substr($tmpStr,0,strpos($tmpStr,"\"")); $tmpStr = substr($tmpStr,strpos($tmpStr,'\'')); $this->torrentName = str_replace("'",'',$tmpStr); $this->torrentSize = $this->cleanLine($tmpListArr["4"]); // MB $this->fileCount = $this->cleanLine($tmpListArr["5"]); // Files $this->Seeds = $this->cleanLine($tmpListArr["6"]); // Seeds $this->Peers = $this->cleanLine($tmpListArr["7"]); // Peers / Leechers $this->dwnldCount = $this->cleanLine($tmpListArr["8"]); // Download Count } else { $this->CatName = $this->cleanLine($tmpListArr["1"]); // Type $tmpStr = $tmpListArr["0"]; // TorrentName and Download Link $tmpStr = substr($tmpStr,strpos($tmpStr,"torrent_details/")); $this->torrentFile = "http://isohunt.com/download/".substr($tmpStr,0,strpos($tmpStr,"'")); $this->torrentName = $this->cleanLine($tmpListArr["2"]); $this->torrentSize = $this->cleanLine($tmpListArr["3"]); // MB $this->fileCount = $this->cleanLine($tmpListArr["4"]); // Files $this->Seeds = $this->cleanLine($tmpListArr["5"]); // Seeds $this->Peers = $this->cleanLine($tmpListArr["6"]); // Peers / Leechers $this->dwnldCount = $this->cleanLine($tmpListArr["7"]); // Download Count } } else { // Search Request // if(strpos($tmpListArr["2"],"[DL]")) { $this->CatName = $this->cleanLine($tmpListArr["0"]); // Type //$tmpListArr["1"] = $this->cleanLine($tmpListArr["1"]); // Age $tmpStr = $tmpListArr["2"]; // TorrentName and Download Link // move to the [DL] area. and remove [REL] line $tmpStr = substr($tmpStr,strpos($tmpStr,"[DL]")+strlen("[DL]"), strpos($tmpStr,"[REL]")); $tmpStr = substr($tmpStr,strpos($tmpStr,"href=\"")+strlen("href=\"")); // Download Link $this->torrentFile = "http://isohunt.com".substr($tmpStr,0,strpos($tmpStr,"\"")); $tmpStr = substr($tmpStr,strpos($tmpStr,"title=\"")+strlen("title=\"")); $tmpStr = substr($tmpStr,0,strpos($tmpStr,"\"")); $tmpStr = substr($tmpStr,strpos($tmpStr,'\'')); $this->torrentName = str_replace(array("'","Download .torrent here: "),'',$tmpStr); } else { $tmpStr = $tmpListArr["0"]; // Download ID and Type $this->CatName = $this->cleanLine($tmpStr); // Download ID and Type $tmpStr = substr($tmpStr,strpos($tmpStr,"torrent_details/")+strlen("torrent_details/")); $this->torrentFile = "http://isohunt.com/download/".substr($tmpStr,0,strpos($tmpStr,",")-1); //$tmpListArr["1"] = $this->cleanLine($tmpListArr["1"]); // Age $this->torrentName = $this->cleanLine($tmpListArr["2"]); } $this->torrentSize = $this->cleanLine($tmpListArr["3"]); // MB $this->Seeds = $this->cleanLine($tmpListArr["4"]); // Seeds $this->Peers = $this->cleanLine($tmpListArr["5"]); // Peers / Leechers $this->torrentDisplayName = $this->torrentName; } if ($this->Peers == '') { $this->Peers = "N/A"; if (empty($this->Seeds)) $this->Seeds = "N/A"; } if ($this->Seeds == '') $this->Seeds = "N/A"; $this->torrentDisplayName = str_replace(".torrent",'',$this->torrentName); if(strlen($this->torrentDisplayName) > 50) { $this->torrentDisplayName = substr($this->torrentDisplayName,0,50)."..."; } } } } function cleanLine($stringIn,$tags='') { if(empty($tags)) return trim(str_replace(array(" "," ")," ",strip_tags($stringIn))); else return trim(str_replace(array(" "," ")," ",strip_tags($stringIn,$tags))); } function dumpArray($arrIn) { foreach($arrIn as $key => $value) { echo "\nkey(".$key.")"."value(".$value.")"; } } //---------------------------------------------------------------- // Function to build output for the table. function BuildOutput($bg) { $output = "\n"; $output .= "
torrentFile."\">torrentName."\" border=0>\n"; $output .= " torrentFile."\" title=\"".$this->torrentName."\">".$this->torrentDisplayName."\n"; $output .= " ". $this->CatName ."\n"; $output .= " ".$this->torrentSize."\n"; $output .= " ".$this->Seeds."\n"; $output .= " ".$this->Peers."\n"; $output .= "\n"; return $output; } } ?>