1
0
Fork 0
forked from blallo/rss-bridge

Filter results by user status (VIP/Trusted/None)

This commit is contained in:
niawag 2016-12-11 12:11:03 +01:00 committed by GitHub
parent b4e6c0d973
commit 8bb002c7b6

View file

@ -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,6 +108,17 @@ class ThePirateBayBridge extends BridgeAbstract{
foreach($html->find('tr') as $element) {
$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;
@ -116,4 +133,5 @@ class ThePirateBayBridge extends BridgeAbstract{
}
}
}
}
}