[GoogleSearchBridge] Use getURI() to build URLs (#1330)

* [GoogleSearchBridge] Use getURI() to build URLs
This commit is contained in:
Joseph 2019-10-16 19:44:28 +00:00 committed by Lyra
parent 0f01cc97a4
commit 46873e14fe

View file

@ -25,10 +25,7 @@ class GoogleSearchBridge extends BridgeAbstract {
public function collectData(){
$html = '';
$html = getSimpleHTMLDOM(self::URI
. 'search?q='
. urlencode($this->getInput('q'))
. '&num=100&complete=0&tbs=qdr:y,sbd:1')
$html = getSimpleHTMLDOM($this->getURI())
or returnServerError('No results for this query.');
$emIsRes = $html->find('div[id=ires]', 0);
@ -54,6 +51,17 @@ class GoogleSearchBridge extends BridgeAbstract {
}
}
public function getURI() {
if (!is_null($this->getInput('q'))) {
return self::URI
. 'search?q='
. urlencode($this->getInput('q'))
. '&num=100&complete=0&tbs=qdr:y,sbd:1';
}
return parent::getURI();
}
public function getName(){
if(!is_null($this->getInput('q'))) {
return $this->getInput('q') . ' - Google search';