Skip to content

Commit 3c2fc6f

Browse files
committed
add device, light request and auto correction to Google Search
1 parent 050fa88 commit 3c2fc6f

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/LaravelScrapingBee.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Ziming\LaravelScrapingBee;
46

57
use Illuminate\Http\Client\ConnectionException;
@@ -204,9 +206,9 @@ public function jsonResponse(): self
204206
/**
205207
* https://www.scrapingbee.com/documentation/#return_page_source
206208
*/
207-
public function returnPageSource(): self
209+
public function returnPageSource(bool $returnPageSource = true): self
208210
{
209-
$this->params['return_page_source'] = true;
211+
$this->params['return_page_source'] = $returnPageSource;
210212

211213
return $this;
212214
}

src/LaravelScrapingBeeGoogleSearch.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Ziming\LaravelScrapingBee;
46

57
use Illuminate\Http\Client\Response;
@@ -72,6 +74,17 @@ public function countryCode(string $countryCode): self
7274
return $this;
7375
}
7476

77+
/**
78+
* https://www.scrapingbee.com/documentation/google/#device
79+
*/
80+
public function device(string $device): self
81+
{
82+
$this->params['device'] = $device;
83+
84+
return $this;
85+
}
86+
87+
7588
/**
7689
* https://www.scrapingbee.com/documentation/google/#nb_results
7790
*/
@@ -102,6 +115,23 @@ public function language(string $language): self
102115
return $this;
103116
}
104117

118+
/**
119+
* https://www.scrapingbee.com/documentation/google/#light_request
120+
*/
121+
public function lightRequest(bool $lightRequest = true): self
122+
{
123+
$this->params['light_request'] = $lightRequest;
124+
125+
return $this;
126+
}
127+
128+
public function autoCorrection(): self
129+
{
130+
$this->params['nfpr'] = true;
131+
132+
return $this;
133+
}
134+
105135
/**
106136
* https://www.scrapingbee.com/documentation/google/#extra_params
107137
*/

0 commit comments

Comments
 (0)