LibreY- privacy respecting meta search engine |
git clone git://git.acid.vegas/LibreY.git |
Log | Files | Refs | Archive | README | LICENSE |
torrentgalaxy.php (1870B)
1 <?php 2 class TorrentGalaxyRequest extends EngineRequest { 3 public function get_request_url() { 4 $query = urlencode($this->query); 5 return "https://torrentgalaxy.to/torrents.php?search=$query#results"; 6 } 7 8 public function parse_results($response) { 9 $xpath = get_xpath($response); 10 $results = array(); 11 12 if (!$xpath) 13 return $results; 14 15 foreach($xpath->query("//div[@class='tgxtablerow txlight']") as $result) 16 { 17 $name = $xpath->evaluate(".//div[contains(@class, 'clickable-row')]", $result)[0]->textContent; 18 $magnet = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/a/@href", $result)[1]->textContent; 19 $magnet_without_tracker = explode("&tr=", $magnet)[0]; 20 $magnet = $magnet_without_tracker . $this->opts->bittorrent_trackers; 21 $size = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span", $result)[0]->textContent; 22 $seeders = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[1]->textContent; 23 $leechers = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[2]->textContent; 24 25 array_push($results, 26 array ( 27 "name" => htmlspecialchars($name), 28 "seeders" => (int) $seeders, 29 "leechers" => (int) $leechers, 30 "magnet" => htmlspecialchars($magnet), 31 "size" => htmlspecialchars($size), 32 "source" => "torrentgalaxy.to" 33 ) 34 ); 35 } 36 37 return $results; 38 } 39 } 40 ?>