You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -290,9 +290,11 @@ Using this Fetcher class, you can make requests with:
290
290
* Mimics some of the real browsers' properties by injecting several JS files and using custom options.
291
291
* Using custom flags on launch to hide Playwright even more and make it faster.
292
292
* Generates real browser's headers of the same type and same user OS then append it to the request's headers.
293
-
3) Real browsers by passing the CDP URL of your browser to be controlled by the Fetcher and most of the options can be enabled on it.
293
+
3) Real browsers by passing the `real_chrome` argument or the CDP URL of your browser to be controlled by the Fetcher and most of the options can be enabled on it.
294
294
4) [NSTBrowser](https://app.nstbrowser.io/r/1vO5e5)'s [docker browserless](https://hub.docker.com/r/nstbrowser/browserless) option by passing the CDP URL and enabling `nstbrowser_mode` option.
295
295
296
+
> Hence using the `real_chrome` argument requires that you have chrome browser installed on your device
297
+
296
298
Add that to a lot of controlling/hiding options as you will see in the arguments list below.
297
299
298
300
<details><summary><strong>Expand this for the complete list of arguments</strong></summary>
@@ -314,6 +316,7 @@ Add that to a lot of controlling/hiding options as you will see in the arguments
314
316
| hide_canvas | Add random noise to canvas operations to prevent fingerprinting. | ✔️ |
315
317
| disable_webgl | Disables WebGL and WebGL 2.0 support entirely. | ✔️ |
316
318
| stealth | Enables stealth mode, always check the documentation to see what stealth mode does currently. | ✔️ |
319
+
| real_chrome | If you have chrome browser installed on your device, enable this and the Fetcher will launch an instance of your browser and use it. | ✔️ |
317
320
| cdp_url | Instead of launching a new browser instance, connect to this CDP URL to control real browsers/NSTBrowser through CDP. | ✔️ |
318
321
| nstbrowser_mode | Enables NSTBrowser mode, **it have to be used with `cdp_url` argument or it will get completely ignored.**| ✔️ |
319
322
| nstbrowser_config | The config you want to send with requests to the NSTBrowser. _If left empty, Scrapling defaults to an optimized NSTBrowser's docker browserless config._ | ✔️ |
Copy file name to clipboardExpand all lines: scrapling/engines/pw.py
+15-9Lines changed: 15 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -27,11 +27,12 @@ def __init__(
27
27
page_action: Callable=do_nothing,
28
28
wait_selector: Optional[str] =None,
29
29
wait_selector_state: Optional[str] ='attached',
30
-
stealth: bool=False,
31
-
hide_canvas: bool=True,
32
-
disable_webgl: bool=False,
30
+
stealth: Optional[bool] =False,
31
+
real_chrome: Optional[bool] =False,
32
+
hide_canvas: Optional[bool] =False,
33
+
disable_webgl: Optional[bool] =False,
33
34
cdp_url: Optional[str] =None,
34
-
nstbrowser_mode: bool=False,
35
+
nstbrowser_mode: Optional[bool]=False,
35
36
nstbrowser_config: Optional[Dict] =None,
36
37
google_search: Optional[bool] =True,
37
38
extra_headers: Optional[Dict[str, str]] =None,
@@ -51,6 +52,7 @@ def __init__(
51
52
:param wait_selector: Wait for a specific css selector to be in a specific state.
52
53
:param wait_selector_state: The state to wait for the selector given with `wait_selector`. Default state is `attached`.
53
54
:param stealth: Enables stealth mode, check the documentation to see what stealth mode does currently.
55
+
:param real_chrome: If you have chrome browser installed on your device, enable this and the Fetcher will launch an instance of your browser and use it.
54
56
:param hide_canvas: Add random noise to canvas operations to prevent fingerprinting.
55
57
:param disable_webgl: Disables WebGL and WebGL 2.0 support entirely.
56
58
:param cdp_url: Instead of launching a new browser instance, connect to this CDP URL to control real browsers/NSTBrowser through CDP.
:return: A `Response` object that is the same as `Adaptor` object except it has these added attributes: `status`, `reason`, `cookies`, `headers`, and `request_headers`
121
124
"""
122
-
ifnotself.stealth:
125
+
ifnotself.stealthorself.real_chrome:
126
+
# Because rebrowser_playwright doesn't play well with real browsers
Copy file name to clipboardExpand all lines: scrapling/fetchers.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -138,20 +138,20 @@ class PlayWrightFetcher(BaseFetcher):
138
138
2) Mimics some of the real browsers' properties by injecting several JS files and using custom options.
139
139
3) Using custom flags on launch to hide Playwright even more and make it faster.
140
140
4) Generates real browser's headers of the same type and same user OS then append it to the request.
141
-
- Real browsers by passing the CDP URL of your browser to be controlled by the Fetcher and most of the options can be enabled on it.
141
+
- Real browsers by passing the `real_chrome` argument or the CDP URL of your browser to be controlled by the Fetcher and most of the options can be enabled on it.
142
142
- NSTBrowser's docker browserless option by passing the CDP URL and enabling `nstbrowser_mode` option.
143
143
144
144
> Note that these are the main options with PlayWright but it can be mixed together.
"""Opens up a browser and do your request based on your chosen options below.
157
157
@@ -167,6 +167,7 @@ def fetch(
167
167
:param wait_selector: Wait for a specific css selector to be in a specific state.
168
168
:param wait_selector_state: The state to wait for the selector given with `wait_selector`. Default state is `attached`.
169
169
:param stealth: Enables stealth mode, check the documentation to see what stealth mode does currently.
170
+
:param real_chrome: If you have chrome browser installed on your device, enable this and the Fetcher will launch an instance of your browser and use it.
170
171
:param hide_canvas: Add random noise to canvas operations to prevent fingerprinting.
171
172
:param disable_webgl: Disables WebGL and WebGL 2.0 support entirely.
172
173
:param google_search: Enabled by default, Scrapling will set the referer header to be as if this request came from a Google search for this website's domain name.
0 commit comments