mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-29 14:48:52 +03:00
[RedditBridge] Search for specific flairs (#3067)
* flair filter * syntax * fix multi & user feeds * ' * dont replace ,
This commit is contained in:
parent
8dcc21a871
commit
30d964b356
1 changed files with 17 additions and 0 deletions
|
@ -41,6 +41,12 @@ class RedditBridge extends BridgeAbstract
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'exampleValue' => 'selfhosted',
|
'exampleValue' => 'selfhosted',
|
||||||
'title' => 'SubReddit name'
|
'title' => 'SubReddit name'
|
||||||
|
],
|
||||||
|
'f' => [
|
||||||
|
'name' => 'Flair',
|
||||||
|
'required' => false,
|
||||||
|
'exampleValue' => 'Proxy',
|
||||||
|
'title' => 'Flair filter'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'multi' => [
|
'multi' => [
|
||||||
|
@ -136,11 +142,22 @@ class RedditBridge extends BridgeAbstract
|
||||||
$keywords = '';
|
$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) {
|
foreach ($subreddits as $subreddit) {
|
||||||
$name = trim($subreddit);
|
$name = trim($subreddit);
|
||||||
$values = getContents(self::URI
|
$values = getContents(self::URI
|
||||||
. '/search.json?q='
|
. '/search.json?q='
|
||||||
. $keywords
|
. $keywords
|
||||||
|
. $flair
|
||||||
. ($user ? 'author%3A' : 'subreddit%3A')
|
. ($user ? 'author%3A' : 'subreddit%3A')
|
||||||
. $name
|
. $name
|
||||||
. '&sort='
|
. '&sort='
|
||||||
|
|
Loading…
Reference in a new issue