[GoogleSearch] feat: add verbatim option (#2858)

The verbatim option is the same as wrapping the query in quotes e.g. "rss-bridge".
This commit is contained in:
Dag 2022-06-24 11:18:27 +02:00 committed by GitHub
parent 1cfcacbbeb
commit 92782e6c34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,12 @@ class GoogleSearchBridge extends BridgeAbstract {
'name' => 'keyword',
'required' => true,
'exampleValue' => 'rss-bridge',
)
),
'verbatim' => array(
'name' => 'Verbatim',
'type' => 'checkbox',
'title' => 'Use literal keyword(s) without making improvements',
),
));
public function collectData(){
@ -78,7 +83,8 @@ class GoogleSearchBridge extends BridgeAbstract {
'hl' => 'en',
'num' => '100', // get 100 results
'complete' => '0',
'tbs' => 'qdr:y,sbd:1' // in past year, sort by date
// in past year, sort by date, optionally verbatim
'tbs' => 'qdr:y,sbd:1' . ($this->getInput('verbatim') ? ',li:1' : ''),
];
return sprintf('https://www.google.com/search?%s', http_build_query($queryParameters));
}