From 13e9a96cf38c1c13ce1451f489288b44941ac480 Mon Sep 17 00:00:00 2001 From: dawidsowa Date: Mon, 19 Apr 2021 19:14:35 +0200 Subject: [PATCH] [RedditBridge]: Add score filter (#2045) --- bridges/RedditBridge.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bridges/RedditBridge.php b/bridges/RedditBridge.php index 1dbd8d91..b83871a9 100644 --- a/bridges/RedditBridge.php +++ b/bridges/RedditBridge.php @@ -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;