[NineGagBridge] Add filter option for animated content (#1374)

This commit is contained in:
David 2019-12-01 13:07:25 +01:00 committed by LogMANOriginal
parent e518936be7
commit 375831f516
1 changed files with 34 additions and 6 deletions

View File

@ -17,6 +17,15 @@ class NineGagBridge extends BridgeAbstract {
'Fresh' => 'fresh', 'Fresh' => 'fresh',
), ),
), ),
'video' => array(
'name' => 'Filter Video',
'type' => 'list',
'values' => array(
'NotFiltred' => 'none',
'VideoFiltred' => 'without',
'VideoOnly' => 'only',
),
),
'p' => array( 'p' => array(
'name' => 'Pages', 'name' => 'Pages',
'type' => 'number', 'type' => 'number',
@ -121,13 +130,32 @@ class NineGagBridge extends BridgeAbstract {
} }
foreach ($posts as $post) { foreach ($posts as $post) {
$item['uri'] = $post['url']; $AvoidElement = false;
$item['title'] = $post['title']; switch ($this->getInput('video')) {
$item['content'] = self::getContent($post); case 'without':
$item['categories'] = self::getCategories($post); if ($post['type'] === 'Animated') {
$item['timestamp'] = self::getTimestamp($post); $AvoidElement = true;
}
break;
case 'only':
echo $post['type'];
if ($post['type'] !== 'Animated') {
$AvoidElement = true;
}
break;
case 'none': default:
break;
}
$this->items[] = $item; if (!$AvoidElement) {
$item['uri'] = $post['url'];
$item['title'] = $post['title'];
$item['content'] = self::getContent($post);
$item['categories'] = self::getCategories($post);
$item['timestamp'] = self::getTimestamp($post);
$this->items[] = $item;
}
} }
} }