[RedditBridge] Search for specific flairs (#3067)

* flair filter

* syntax

* fix multi & user feeds

* '

* dont replace ,
This commit is contained in:
joshinat0r 2022-10-02 07:34:20 +02:00 committed by GitHub
parent 8dcc21a871
commit 30d964b356
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,6 +41,12 @@ class RedditBridge extends BridgeAbstract
'required' => true,
'exampleValue' => 'selfhosted',
'title' => 'SubReddit name'
],
'f' => [
'name' => 'Flair',
'required' => false,
'exampleValue' => 'Proxy',
'title' => 'Flair filter'
]
],
'multi' => [
@ -136,11 +142,22 @@ class RedditBridge extends BridgeAbstract
$keywords = '';
}
if (!($this->getInput('f') === '') && $this->queriedContext == 'single') {
$flair = $this->getInput('f');
$flair = str_replace(' ', '%20', $flair);
$flair = 'flair%3A%22' . $flair . '%22%20';
} else {
$flair = '';
}
foreach ($subreddits as $subreddit) {
$name = trim($subreddit);
$values = getContents(self::URI
. '/search.json?q='
. $keywords
. $flair
. ($user ? 'author%3A' : 'subreddit%3A')
. $name
. '&sort='