Skip to content

Commit 96af309

Browse files
committed
changing user-agent fixes google search
1 parent 269a186 commit 96af309

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Engine/GoogleSearch.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace SerpScraper\Engine;
44

5+
use Curl\UserAgents;
56
use SerpScraper\SearchResponse;
67

78
class GoogleSearch extends SearchEngine
@@ -12,6 +13,9 @@ function __construct()
1213

1314
$this->preferences['results_per_page'] = 100;
1415
$this->preferences['google_domain'] = 'google.com';
16+
17+
$agent = UserAgents::getRandomGsaUserAgent();
18+
$this->getBrowser()->setUserAgent($agent);
1519
}
1620

1721
private function getNextPage($html)

0 commit comments

Comments
 (0)