returnError('You must specify a keyword (?q=...)', 400); $html = file_get_html('https://thepiratebay.se/search/'.rawurlencode($param['q']).'/0/99/0') or $this->returnError('Could not request TPB.', 404); if($html->find('table#searchResult', 0) == FALSE) $this->returnError('No result for this query', 404); foreach($html->find('tr') as $element) { $item = new \Item(); $item->uri = 'https://thepiratebay.se/'.$element->find('a.detLink',0)->href; $item->id = $item->uri; $item->timestamp = time(); $item->title = $element->find('a.detLink',0)->plaintext; $item->content = $element->find('font',0)->plaintext.'
download'; if(!empty($item->title)) $this->items[] = $item; } } public function getName(){ return 'The Pirate Bay'; } public function getURI(){ return 'https://thepiratebay.se/'; } public function getCacheDuration(){ return 3600; // 1 hour } }