diff --git a/bridges/ThePirateBayBridge.php b/bridges/ThePirateBayBridge.php index 5d772df..7b3edd6 100644 --- a/bridges/ThePirateBayBridge.php +++ b/bridges/ThePirateBayBridge.php @@ -29,6 +29,10 @@ class ThePirateBayBridge extends BridgeAbstract{ 'name'=>'Category number', 'exampleValue'=>'100, 200… See TPB for category number' ), + 'trusted'=>array( + 'type'=>'checkbox', + 'name'=>'Only get results from Trusted or VIP users ?', + ), )); public function collectData(){ @@ -72,6 +76,8 @@ class ThePirateBayBridge extends BridgeAbstract{ $catNum = $this->getInput('cat'); } $critList = $this->getInput('crit'); + + $trustedBool = $this->getInput('trusted'); $keywordsList = explode(";",$this->getInput('q')); foreach($keywordsList as $keywords){ switch ($critList) { @@ -102,17 +108,29 @@ class ThePirateBayBridge extends BridgeAbstract{ foreach($html->find('tr') as $element) { - $item = array(); - $item['uri'] = $element->find('a',3)->href; - $item['id'] = self::URI.$element->find('a.detLink',0)->href; - $item['timestamp'] = parseDateTimestamp($element); - $item['author'] = $element->find('a.detDesc',0)->plaintext; - $item['title'] = $element->find('a.detLink',0)->plaintext; - $item['seeders'] = (int)$element->find('td',2)->plaintext; - $item['leechers'] = (int)$element->find('td',3)->plaintext; - $item['content'] = $element->find('font',0)->plaintext.'
seeders: '.$item['seeders'].' | leechers: '.$item['leechers'].'
info page'; - if(isset($item['title'])) - $this->items[] = $item; + $skip = FALSE; + + if ($trustedBool) + { + $element_str = (string)$element; + if (strpos($element_str, 'VIP') == FALSE and strpos($element_str, 'Trusted') == FALSE ) + $skip = TRUE; + } + + if ( $skip == FALSE ) + { + $item = array(); + $item['uri'] = $element->find('a',3)->href; + $item['id'] = self::URI.$element->find('a.detLink',0)->href; + $item['timestamp'] = parseDateTimestamp($element); + $item['author'] = $element->find('a.detDesc',0)->plaintext; + $item['title'] = $element->find('a.detLink',0)->plaintext; + $item['seeders'] = (int)$element->find('td',2)->plaintext; + $item['leechers'] = (int)$element->find('td',3)->plaintext; + $item['content'] = $element->find('font',0)->plaintext.'
seeders: '.$item['seeders'].' | leechers: '.$item['leechers'].'
info page'; + if(isset($item['title'])) + $this->items[] = $item; + } } } }