Skip to content

Commit

Permalink
[RedditBridge]: Add score filter (#2045)
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowa authored Apr 19, 2021
1 parent 00a24a9 commit 13e9a96
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bridges/RedditBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -86,6 +95,10 @@ public function collectData() {

$data = $post->data;

if ($data->score < $this->getInput('score')) {
continue;
}

$item = array();
$item['author'] = $data->author;
$item['uid'] = $data->id;
Expand Down

0 comments on commit 13e9a96

Please sign in to comment.