[RedditBridge]: Add score filter (#2045)

This commit is contained in:
dawidsowa 2021-04-19 19:14:35 +02:00 committed by GitHub
parent 00a24a98be
commit 13e9a96cf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,15 @@ class RedditBridge extends BridgeAbstract {
const DESCRIPTION = 'Return hot submissions from Reddit';
const PARAMETERS = array(
'global' => array(
'score' => array(
'name' => 'Minimal score',
'required' => false,
'type' => 'number',
'exampleValue' => 100,
'title' => 'Filter out posts with lower score'
)
),
'single' => array(
'r' => array(
'name' => 'SubReddit',
@ -86,6 +95,10 @@ class RedditBridge extends BridgeAbstract {
$data = $post->data;
if ($data->score < $this->getInput('score')) {
continue;
}
$item = array();
$item['author'] = $data->author;
$item['uid'] = $data->id;