[GoogleSearch] Correct parsing uri of search result (#1601)

This commit is contained in:
Eugene Molotov 2020-07-27 11:44:07 +05:00 committed by GitHub
parent 78facbcb83
commit a33088ca99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,14 +35,8 @@ class GoogleSearchBridge extends BridgeAbstract {
$item = array();
// Extract direct URL from google href (eg. /url?q=...)
$t = $element->find('a[href]', 0)->href;
$item['uri'] = '' . $t;
parse_str(parse_url($t, PHP_URL_QUERY), $parameters);
if(isset($parameters['q'])) {
$item['uri'] = $parameters['q'];
}
$item['uri'] = htmlspecialchars_decode($t);
$item['title'] = $element->find('h3', 0)->plaintext;
$item['content'] = $element->find('span[class=st]', 0)->plaintext;