@mrscraper/sdk 6.0.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -113
- package/dist/api.d.ts +28 -35
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +130 -65
- package/dist/api.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,15 +8,15 @@ An async JavaScript and TypeScript SDK for the seven MrScraper services.
|
|
|
8
8
|
|
|
9
9
|
Seven services share the same descriptions, parameter meanings, and defaults across the CLI, SDKs, and integrations. Names, types, authentication, and code examples follow each surface's conventions. See the [API Reference](https://docs.mrscraper.com/docs/api/overview).
|
|
10
10
|
|
|
11
|
-
| Service | Public name | Description
|
|
12
|
-
| ----------------------------------- | ---------------- |
|
|
13
|
-
| [Status](#status) | `status` | Return the raw account status API response without summarizing, redacting body fields, or adding calculated fields.
|
|
14
|
-
| [Scrape HTML](#scrape-html) | `scrapeHtml` | Retrieve the raw HTML of a page. Browser rendering is optional.
|
|
15
|
-
| [Scrape Markdown](#scrape-markdown) | `scrapeMarkdown` | Retrieve a page as Markdown.
|
|
16
|
-
| [Get screenshot](#get-screenshot) | `getScreenshot` | Capture a base64 screenshot of the full page or
|
|
17
|
-
| [Scrape brand](#scrape-brand) | `scrapeBrand` | Extract a website's colors, typography, logos, and social links as JSON.
|
|
18
|
-
| [Scrape JSON](#scrape-json) | `scrapeJson` | Extract structured JSON from a page using a natural-language prompt. Append Json Schema: and a JSON schema to shape the output.
|
|
19
|
-
| [Web search](#web-search) | `webSearch` | Search the web and return ranked results with titles, URLs, descriptions, and sources.
|
|
11
|
+
| Service | Public name | Description |
|
|
12
|
+
| ----------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| [Status](#status) | `status` | Return the raw account status API response without summarizing, redacting body fields, or adding calculated fields. |
|
|
14
|
+
| [Scrape HTML](#scrape-html) | `scrapeHtml` | Retrieve the raw HTML of a page. Browser rendering is optional. |
|
|
15
|
+
| [Scrape Markdown](#scrape-markdown) | `scrapeMarkdown` | Retrieve a page as clean Markdown. Browser rendering is optional. |
|
|
16
|
+
| [Get screenshot](#get-screenshot) | `getScreenshot` | Capture a base64 PNG screenshot of the full page, the first viewport, or a custom viewport. Browser rendering is always enabled. |
|
|
17
|
+
| [Scrape brand](#scrape-brand) | `scrapeBrand` | Extract a website's colors, typography, logos, and social links as JSON. |
|
|
18
|
+
| [Scrape JSON](#scrape-json) | `scrapeJson` | Extract structured JSON from a page using a natural-language prompt. Append Json Schema: and a JSON schema to shape the output. |
|
|
19
|
+
| [Web search](#web-search) | `webSearch` | Search the web and return ranked results with titles, URLs, descriptions, and sources. |
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
@@ -59,11 +59,15 @@ Response examples show selected keys and types observed in live API responses. V
|
|
|
59
59
|
|
|
60
60
|
### Page controls
|
|
61
61
|
|
|
62
|
-
HTML, Markdown, screenshots, and JSON extraction share `url`, `timeout`, `
|
|
62
|
+
HTML, Markdown, screenshots, and JSON extraction share `url`, `timeout`, `waitForSelector`, `geoCode`, `maxAge`, and `maxRetries` (using the naming style shown below). Defaults are a 300-second timeout (up to 330) and a `maxAge` of 0 milliseconds, which always scrapes fresh; `maxAge` accepts up to 604800000 (7 days). `geoCode` and `maxRetries` are omitted unless set, so the API loads the page from the United States with no retry limit. Results are always saved to the dashboard (`saveResult=true`), and `tokenCap` is never sent. Exact types, defaults, and standard descriptions appear in each service table.
|
|
63
63
|
|
|
64
64
|
### Loading controls
|
|
65
65
|
|
|
66
|
-
HTML, Markdown, and
|
|
66
|
+
HTML, Markdown, and JSON extraction also accept `browserRendering`, `warmStart`, and `blockResources`; HTML and Markdown also accept `action`. `browserRendering` is omitted unless set: the API loads the page without a browser first and switches to one if the request is blocked, while `true` always renders and `false` never does. Screenshots always render in a browser: Get screenshot sends `browserRendering=true`, and so does Scrape HTML whenever a screenshot is set.
|
|
67
|
+
|
|
68
|
+
### Fixed request fields
|
|
69
|
+
|
|
70
|
+
Each service adds its documented fixed fields automatically, so they are not service parameters: `html=true` and `markdown=false` for HTML (plus `browserRendering=true` when a screenshot is set), `markdown=true`, `html=false`, and `screenshot=false` for Markdown, `browserRendering=true`, `html=false`, and `markdown=false` for screenshots, `action=brand-scraping` and `bundle=none` for brand, `agent=general` for JSON extraction, and `action=websearch` for search. HTML, Markdown, screenshots, and JSON extraction also always send `saveResult=true`.
|
|
67
71
|
|
|
68
72
|
## Service reference
|
|
69
73
|
|
|
@@ -137,22 +141,21 @@ Retrieve the raw HTML of a page. Browser rendering is optional.
|
|
|
137
141
|
|
|
138
142
|
#### Parameters
|
|
139
143
|
|
|
140
|
-
| Parameter | HTTP field | Type
|
|
141
|
-
| ------------------ | ------------------ |
|
|
142
|
-
| `url` | `url` | string
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
| `warmStart` | `warmStart` | boolean | `false` | Whether to enable warm start for more reliable scraping, at the cost of additional latency. |
|
|
144
|
+
| Parameter | HTTP field | Type | Default | Description |
|
|
145
|
+
| ------------------ | ------------------ | ----------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
146
|
+
| `url` | `url` | string | Required | Absolute HTTP or HTTPS URL of the page to process. |
|
|
147
|
+
| `browserRendering` | `browserRendering` | boolean | Omitted | Whether to load the page in a browser: true always does and false never does. Omit it to load the page without a browser first and switch to a browser automatically if the request is blocked. |
|
|
148
|
+
| `timeout` | `timeout` | number (integer) | `300` | Maximum seconds to wait for the scrape, from 1 to 330. The HTTP request allows 30 additional seconds. |
|
|
149
|
+
| `warmStart` | `warmStart` | boolean | `false` | Whether to open the site's home page first to warm the session before loading the target URL. |
|
|
150
|
+
| `blockResources` | `blockResources` | boolean | `false` | Whether to block images, fonts, and stylesheets while loading the page. |
|
|
151
|
+
| `waitForSelector` | `waitForSelector` | string | Omitted | CSS selector or text to wait for on the page before returning the result, up to 500 characters. |
|
|
152
|
+
| `action` | `action` | string | Omitted | Scraper action that routes the request or simply flags it, useful for separating analytics per domain. |
|
|
153
|
+
| `geoCode` | `geoCode` | string | Omitted | Two-letter country code to load the page from, sent in lowercase. |
|
|
154
|
+
| `maxAge` | `maxAge` | number (integer) | `0` | Return a cached result of the same request when it is newer than the selected age. A cached result costs the same tokens as the original scrape. |
|
|
155
|
+
| `maxRetries` | `maxRetries` | number (integer) | Omitted | Maximum number of retries, as a nonnegative integer. Omit this parameter for no limit. |
|
|
156
|
+
| `screenshot` | `screenshot` | `false` or string | `false` | Screenshot to capture with the HTML: false for none, full for the entire page, top for the first viewport, or a WIDTHxHEIGHT viewport from 100 to 3840 pixels with an optional -ZOOM percent from 25 to 300, such as 1280x800 or 1920x1080-75. Setting a screenshot also sends browserRendering=true. |
|
|
157
|
+
|
|
158
|
+
The request uses `html=true`, `markdown=false`, and `saveResult=true`. The screenshot is optional; setting one also sends `browserRendering=true`, because a screenshot needs a rendered page, and the response becomes JSON with `html` and `screenshot`.
|
|
156
159
|
|
|
157
160
|
#### Example
|
|
158
161
|
|
|
@@ -171,9 +174,9 @@ console.log(result.data);
|
|
|
171
174
|
|
|
172
175
|
#### Response
|
|
173
176
|
|
|
174
|
-
The
|
|
177
|
+
The response body is HTML text. With a screenshot, the API returns JSON containing html and a base64 screenshot.
|
|
175
178
|
|
|
176
|
-
**
|
|
179
|
+
**Default HTML text**
|
|
177
180
|
|
|
178
181
|
```json
|
|
179
182
|
{
|
|
@@ -185,31 +188,43 @@ The default response body is HTML text. Additional controls can cause the API to
|
|
|
185
188
|
}
|
|
186
189
|
```
|
|
187
190
|
|
|
191
|
+
**With a screenshot**
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"status_code": 200,
|
|
196
|
+
"data": {
|
|
197
|
+
"html": "<html>...</html>",
|
|
198
|
+
"screenshot": "BASE64_IMAGE_DATA"
|
|
199
|
+
},
|
|
200
|
+
"headers": {
|
|
201
|
+
"content-type": "application/json; charset=utf-8"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
188
206
|
### Scrape Markdown
|
|
189
207
|
|
|
190
208
|
#### Description
|
|
191
209
|
|
|
192
|
-
Retrieve a page as Markdown.
|
|
210
|
+
Retrieve a page as clean Markdown. Browser rendering is optional.
|
|
193
211
|
|
|
194
212
|
#### Parameters
|
|
195
213
|
|
|
196
|
-
| Parameter | HTTP field | Type
|
|
197
|
-
| ------------------ | ------------------ |
|
|
198
|
-
| `url` | `url` | string
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
| `browserRendering` | `browserRendering` | boolean | `false` | Whether to render the page in a browser before returning the result. |
|
|
211
|
-
| `warmStart` | `warmStart` | boolean | `false` | Whether to enable warm start for more reliable scraping, at the cost of additional latency. |
|
|
212
|
-
| `html` | `html` | boolean | `false` | Whether to include the page HTML in the response. |
|
|
214
|
+
| Parameter | HTTP field | Type | Default | Description |
|
|
215
|
+
| ------------------ | ------------------ | ---------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
216
|
+
| `url` | `url` | string | Required | Absolute HTTP or HTTPS URL of the page to process. |
|
|
217
|
+
| `browserRendering` | `browserRendering` | boolean | Omitted | Whether to load the page in a browser: true always does and false never does. Omit it to load the page without a browser first and switch to a browser automatically if the request is blocked. |
|
|
218
|
+
| `timeout` | `timeout` | number (integer) | `300` | Maximum seconds to wait for the scrape, from 1 to 330. The HTTP request allows 30 additional seconds. |
|
|
219
|
+
| `warmStart` | `warmStart` | boolean | `false` | Whether to open the site's home page first to warm the session before loading the target URL. |
|
|
220
|
+
| `blockResources` | `blockResources` | boolean | `false` | Whether to block images, fonts, and stylesheets while loading the page. |
|
|
221
|
+
| `waitForSelector` | `waitForSelector` | string | Omitted | CSS selector or text to wait for on the page before returning the result, up to 500 characters. |
|
|
222
|
+
| `action` | `action` | string | Omitted | Scraper action that routes the request or simply flags it, useful for separating analytics per domain. |
|
|
223
|
+
| `geoCode` | `geoCode` | string | Omitted | Two-letter country code to load the page from, sent in lowercase. |
|
|
224
|
+
| `maxAge` | `maxAge` | number (integer) | `0` | Return a cached result of the same request when it is newer than the selected age. A cached result costs the same tokens as the original scrape. |
|
|
225
|
+
| `maxRetries` | `maxRetries` | number (integer) | Omitted | Maximum number of retries, as a nonnegative integer. Omit this parameter for no limit. |
|
|
226
|
+
|
|
227
|
+
The request uses `markdown=true`, `html=false`, `screenshot=false`, and `saveResult=true`.
|
|
213
228
|
|
|
214
229
|
#### Example
|
|
215
230
|
|
|
@@ -217,30 +232,15 @@ Retrieve a page as Markdown. Including HTML also enables browser rendering and r
|
|
|
217
232
|
import { scrapeMarkdown } from "@mrscraper/sdk";
|
|
218
233
|
|
|
219
234
|
const result = await scrapeMarkdown("https://example.com", {
|
|
220
|
-
html: true,
|
|
221
235
|
warmStart: true,
|
|
236
|
+
maxAge: 86400000,
|
|
222
237
|
});
|
|
223
238
|
console.log(result.data);
|
|
224
239
|
```
|
|
225
240
|
|
|
226
241
|
#### Response
|
|
227
242
|
|
|
228
|
-
The
|
|
229
|
-
|
|
230
|
-
**With html enabled**
|
|
231
|
-
|
|
232
|
-
```json
|
|
233
|
-
{
|
|
234
|
-
"status_code": 200,
|
|
235
|
-
"data": {
|
|
236
|
-
"html": "<html>...</html>",
|
|
237
|
-
"markdown": "# Example page\n\n..."
|
|
238
|
-
},
|
|
239
|
-
"headers": {
|
|
240
|
-
"content-type": "application/json"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
```
|
|
243
|
+
The response body is Markdown text.
|
|
244
244
|
|
|
245
245
|
**Default Markdown text**
|
|
246
246
|
|
|
@@ -258,27 +258,21 @@ The default response body is Markdown text. Enabling HTML returns JSON containin
|
|
|
258
258
|
|
|
259
259
|
#### Description
|
|
260
260
|
|
|
261
|
-
Capture a base64 screenshot of the full page or
|
|
261
|
+
Capture a base64 PNG screenshot of the full page, the first viewport, or a custom viewport. Browser rendering is always enabled.
|
|
262
262
|
|
|
263
263
|
#### Parameters
|
|
264
264
|
|
|
265
|
-
| Parameter | HTTP field | Type
|
|
266
|
-
| ----------------- | ----------------- |
|
|
267
|
-
| `url` | `url` | string
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
271
|
-
| `
|
|
272
|
-
| `
|
|
273
|
-
| `
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
| `blockResources` | `blockResources` | boolean | `false` | Whether to block images, fonts, and stylesheets while loading the page. |
|
|
277
|
-
| `waitForSelector` | `waitForSelector` | string | Omitted | Wait for the page to contain the specified CSS selector before returning the result. |
|
|
278
|
-
| `returnCookie` | `returnCookie` | boolean | `false` | Whether to include browser session cookies in the response. |
|
|
279
|
-
| `screenshot` | `screenshot` | string: `full`, `top` | `"full"` | Screenshot area to capture: full for the entire page or top for the top viewport. |
|
|
280
|
-
| `html` | `html` | boolean | `true` | Whether to include the page HTML in the response. |
|
|
281
|
-
| `markdown` | `markdown` | boolean | `false` | Whether to include the page Markdown in the response. |
|
|
265
|
+
| Parameter | HTTP field | Type | Default | Description |
|
|
266
|
+
| ----------------- | ----------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
267
|
+
| `url` | `url` | string | Required | Absolute HTTP or HTTPS URL of the page to process. |
|
|
268
|
+
| `screenshot` | `screenshot` | string | `"full"` | Screenshot area to capture: full for the entire scroll height, top for the first viewport, or a WIDTHxHEIGHT viewport from 100 to 3840 pixels with an optional -ZOOM percent from 25 to 300, such as 1280x800 or 1920x1080-75. |
|
|
269
|
+
| `timeout` | `timeout` | number (integer) | `300` | Maximum seconds to wait for the scrape, from 1 to 330. The HTTP request allows 30 additional seconds. |
|
|
270
|
+
| `waitForSelector` | `waitForSelector` | string | Omitted | CSS selector or text to wait for on the page before returning the result, up to 500 characters. |
|
|
271
|
+
| `geoCode` | `geoCode` | string | Omitted | Two-letter country code to load the page from, sent in lowercase. |
|
|
272
|
+
| `maxAge` | `maxAge` | number (integer) | `0` | Return a cached result of the same request when it is newer than the selected age. A cached result costs the same tokens as the original scrape. |
|
|
273
|
+
| `maxRetries` | `maxRetries` | number (integer) | Omitted | Maximum number of retries, as a nonnegative integer. Omit this parameter for no limit. |
|
|
274
|
+
|
|
275
|
+
The request uses `browserRendering=true`, `html=false`, `markdown=false`, and `saveResult=true`; these are not service parameters. `screenshot` defaults to `full` and also accepts `top` or a `WIDTHxHEIGHT[-ZOOM]` viewport. The API still includes the page HTML in the response.
|
|
282
276
|
|
|
283
277
|
#### Example
|
|
284
278
|
|
|
@@ -287,15 +281,14 @@ import { getScreenshot } from "@mrscraper/sdk";
|
|
|
287
281
|
|
|
288
282
|
const result = await getScreenshot("https://example.com", {
|
|
289
283
|
screenshot: "top",
|
|
290
|
-
|
|
291
|
-
markdown: true,
|
|
284
|
+
timeout: 120,
|
|
292
285
|
});
|
|
293
286
|
console.log(result.data);
|
|
294
287
|
```
|
|
295
288
|
|
|
296
289
|
#### Response
|
|
297
290
|
|
|
298
|
-
The response body
|
|
291
|
+
The response body is JSON containing a base64 PNG screenshot and the page HTML, which the API includes even though html=false is sent.
|
|
299
292
|
|
|
300
293
|
**Success response**
|
|
301
294
|
|
|
@@ -304,8 +297,7 @@ The response body contains a base64 screenshot and requested page outputs. The A
|
|
|
304
297
|
"status_code": 200,
|
|
305
298
|
"data": {
|
|
306
299
|
"html": "<html>...</html>",
|
|
307
|
-
"screenshot": "BASE64_PNG_DATA"
|
|
308
|
-
"markdown": "# Example page\n\n..."
|
|
300
|
+
"screenshot": "BASE64_PNG_DATA"
|
|
309
301
|
},
|
|
310
302
|
"headers": {
|
|
311
303
|
"content-type": "application/json; charset=utf-8"
|
|
@@ -384,23 +376,22 @@ Extract structured JSON from a page using a natural-language prompt. Append Json
|
|
|
384
376
|
|
|
385
377
|
#### Parameters
|
|
386
378
|
|
|
387
|
-
| Parameter | HTTP field | Type
|
|
388
|
-
| ------------------ | ------------------ |
|
|
389
|
-
| `url` | `url` | string
|
|
390
|
-
| `
|
|
391
|
-
| `
|
|
392
|
-
| `
|
|
393
|
-
| `
|
|
394
|
-
| `
|
|
395
|
-
| `
|
|
396
|
-
| `
|
|
397
|
-
| `
|
|
398
|
-
| `
|
|
399
|
-
| `
|
|
400
|
-
| `
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
The request uses `agent=general` and GET. If the encoded URL exceeds 8,000 characters, it switches to POST with `url`, `prompt`, and `agent` in the body; page controls remain in the query.
|
|
379
|
+
| Parameter | HTTP field | Type | Default | Description |
|
|
380
|
+
| ------------------ | ------------------ | ---------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
381
|
+
| `url` | `url` | string | Required | Absolute HTTP or HTTPS URL of the page to process. |
|
|
382
|
+
| `prompt` | `prompt` | string | `"Extract all data as complete as possible."` | Instructions describing the data to extract. Append Json Schema: and a JSON schema to shape the output. |
|
|
383
|
+
| `html` | `html` | boolean | `true` | Whether to include the page HTML in the response. |
|
|
384
|
+
| `browserRendering` | `browserRendering` | boolean | Omitted | Whether to load the page in a browser: true always does and false never does. Omit it to load the page without a browser first and switch to a browser automatically if the request is blocked. |
|
|
385
|
+
| `timeout` | `timeout` | number (integer) | `300` | Maximum seconds to wait for the scrape, from 1 to 330. The HTTP request allows 30 additional seconds. |
|
|
386
|
+
| `warmStart` | `warmStart` | boolean | `false` | Whether to open the site's home page first to warm the session before loading the target URL. |
|
|
387
|
+
| `blockResources` | `blockResources` | boolean | `false` | Whether to block images, fonts, and stylesheets while loading the page. |
|
|
388
|
+
| `waitForSelector` | `waitForSelector` | string | Omitted | CSS selector or text to wait for on the page before returning the result, up to 500 characters. |
|
|
389
|
+
| `geoCode` | `geoCode` | string | Omitted | Two-letter country code to load the page from, sent in lowercase. |
|
|
390
|
+
| `maxAge` | `maxAge` | number (integer) | `0` | Return a cached result of the same request when it is newer than the selected age. A cached result costs the same tokens as the original scrape. |
|
|
391
|
+
| `maxRetries` | `maxRetries` | number (integer) | Omitted | Maximum number of retries, as a nonnegative integer. Omit this parameter for no limit. |
|
|
392
|
+
| `screenshot` | `screenshot` | boolean | `false` | Whether to include a base64 screenshot in the response. |
|
|
393
|
+
|
|
394
|
+
The request uses `agent=general`, `saveResult=true`, and GET. If the encoded URL exceeds 8,000 characters, it switches to POST with `url`, `prompt`, and `agent` in the body; page controls remain in the query.
|
|
404
395
|
|
|
405
396
|
#### Example
|
|
406
397
|
|
|
@@ -417,7 +408,7 @@ console.log(result.data);
|
|
|
417
408
|
|
|
418
409
|
#### Response
|
|
419
410
|
|
|
420
|
-
Extraction results are in the API body's data field and follow the requested schema. Response metadata includes thread_id, token_usage, status, error, runtime, and cookies. html
|
|
411
|
+
Extraction results are in the API body's data field and follow the requested schema. Response metadata includes thread_id, token_usage, status, error, runtime, and cookies. html contains the page HTML unless disabled; markdown and screenshot can be empty strings.
|
|
421
412
|
|
|
422
413
|
**Success response**
|
|
423
414
|
|
|
@@ -434,7 +425,7 @@ Extraction results are in the API body's data field and follow the requested sch
|
|
|
434
425
|
],
|
|
435
426
|
"thread_id": "THREAD_ID",
|
|
436
427
|
"token_usage": 1,
|
|
437
|
-
"html": "",
|
|
428
|
+
"html": "<html>...</html>",
|
|
438
429
|
"markdown": "",
|
|
439
430
|
"screenshot": "",
|
|
440
431
|
"status": "Results ready",
|
|
@@ -459,11 +450,13 @@ Search the web and return ranked results with titles, URLs, descriptions, and so
|
|
|
459
450
|
| Parameter | HTTP field | Type | Default | Description |
|
|
460
451
|
| ------------ | ------------ | ---------------- | -------- | ------------------------------------------------------------------------------------------------- |
|
|
461
452
|
| `query` | `query` | string | Required | Search query text, trimmed before sending, containing 1 to 1000 characters. |
|
|
462
|
-
| `country` | `country` | string |
|
|
453
|
+
| `country` | `country` | string | Omitted | Two-letter country code to search from, sent in lowercase. |
|
|
463
454
|
| `numResults` | `numResults` | number (integer) | `10` | Number of search results to request, as an integer from 10 to 100. Fewer results may be returned. |
|
|
464
455
|
|
|
465
456
|
The HTTP deadline is fixed at 120 seconds. It is not a service parameter.
|
|
466
457
|
|
|
458
|
+
The request uses `action=websearch`. `country` is omitted unless set, so the API searches from the United States.
|
|
459
|
+
|
|
467
460
|
#### Example
|
|
468
461
|
|
|
469
462
|
```js
|
|
@@ -541,7 +534,7 @@ try {
|
|
|
541
534
|
|
|
542
535
|
### Configuration
|
|
543
536
|
|
|
544
|
-
Functions return promises and use camelCase options. Omit optional controls or use `undefined`; explicit `false` and `0` are preserved. TypeScript exports include `PageOptions`, `HtmlOptions`, `MarkdownOptions`, `ScreenshotOptions`, `JsonOptions`, `WebSearchOptions`, `StatusOptions`, and `MrScraperResponse<T>`.
|
|
537
|
+
Functions return promises and use camelCase options. Omit optional controls or use `undefined`; explicit `false` and `0` are preserved. TypeScript exports include `PageOptions`, `LoadingOptions`, `HtmlOptions`, `MarkdownOptions`, `ScreenshotOptions`, `JsonOptions`, `WebSearchOptions`, `StatusOptions`, and `MrScraperResponse<T>`.
|
|
545
538
|
|
|
546
539
|
### Advanced usage
|
|
547
540
|
|
|
@@ -572,11 +565,7 @@ if (
|
|
|
572
565
|
|
|
573
566
|
### Troubleshooting
|
|
574
567
|
|
|
575
|
-
Check environment credentials when authentication fails. Use camelCase option names
|
|
576
|
-
|
|
577
|
-
## Migration
|
|
578
|
-
|
|
579
|
-
Replace `account()` with `status()` and read the raw API body. Remove status/search timeout options and rename `superMode` to `super`. Replace combined scraper calls with `scrapeHtml`, `scrapeMarkdown`, or `getScreenshot`; use camelCase options. Replace `full_page` with `screenshot: "full"` or `"top"`. Search uses `query`, `country`, and `numResults`.
|
|
568
|
+
Check environment credentials when authentication fails. Use camelCase option names rather than snake_case. Page timeouts are integers from 1 to 330; status and search do not expose timeout options.
|
|
580
569
|
|
|
581
570
|
## Development and testing
|
|
582
571
|
|
package/dist/api.d.ts
CHANGED
|
@@ -12,58 +12,51 @@ export interface StatusOptions {
|
|
|
12
12
|
/** API key used to authenticate the request. */
|
|
13
13
|
token?: string;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
/** Page controls shared by HTML, Markdown, screenshots, and JSON extraction. */
|
|
16
16
|
export interface PageOptions {
|
|
17
17
|
/** API key used to authenticate the request. */
|
|
18
18
|
token?: string;
|
|
19
|
-
/**
|
|
19
|
+
/** Maximum seconds to wait for the scrape, from 1 to 330. The HTTP request allows 30 additional seconds. */
|
|
20
20
|
timeout?: number;
|
|
21
|
+
/** CSS selector or text to wait for on the page before returning the result, up to 500 characters. */
|
|
22
|
+
waitForSelector?: string;
|
|
21
23
|
/** Two-letter country code to load the page from, sent in lowercase. */
|
|
22
24
|
geoCode?: string;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/** Whether to route the request through real devices. */
|
|
26
|
-
super?: boolean;
|
|
27
|
-
/** Navigation completion event to wait for: domcontentloaded, load, networkidle0, or networkidle2. */
|
|
28
|
-
waitUntil?: WaitUntil;
|
|
29
|
-
/** Custom proxy URL used to load the page. */
|
|
30
|
-
proxy?: string;
|
|
25
|
+
/** Return a cached result of the same request when it is newer than the selected age. A cached result costs the same tokens as the original scrape. */
|
|
26
|
+
maxAge?: number;
|
|
31
27
|
/** Maximum number of retries, as a nonnegative integer. Omit this parameter for no limit. */
|
|
32
28
|
maxRetries?: number;
|
|
33
|
-
/** Whether to save the result to the dashboard Result tab. */
|
|
34
|
-
saveResult?: boolean;
|
|
35
29
|
}
|
|
30
|
+
/** Loading controls accepted by HTML, Markdown, and JSON extraction. */
|
|
36
31
|
export interface LoadingOptions {
|
|
32
|
+
/** Whether to load the page in a browser: true always does and false never does. Omit it to load the page without a browser first and switch to a browser automatically if the request is blocked. */
|
|
33
|
+
browserRendering?: boolean;
|
|
34
|
+
/** Whether to open the site's home page first to warm the session before loading the target URL. */
|
|
35
|
+
warmStart?: boolean;
|
|
37
36
|
/** Whether to block images, fonts, and stylesheets while loading the page. */
|
|
38
37
|
blockResources?: boolean;
|
|
39
|
-
/** Wait for the page to contain the specified CSS selector before returning the result. */
|
|
40
|
-
waitForSelector?: string;
|
|
41
|
-
/** Whether to include browser session cookies in the response. */
|
|
42
|
-
returnCookie?: boolean;
|
|
43
38
|
}
|
|
39
|
+
/** Screenshot area: full, top, or a WIDTHxHEIGHT viewport with an optional -ZOOM percent. */
|
|
40
|
+
export type ScreenshotArea = "full" | "top" | `${number}x${number}` | `${number}x${number}-${number}`;
|
|
41
|
+
/** Scrape HTML screenshot: false for none, or a screenshot area. */
|
|
42
|
+
export type ScreenshotCapture = false | ScreenshotArea;
|
|
44
43
|
export interface HtmlOptions extends PageOptions, LoadingOptions {
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
|
|
44
|
+
/** Scraper action that routes the request or simply flags it, useful for separating analytics per domain. */
|
|
45
|
+
action?: string;
|
|
46
|
+
/** Screenshot to capture with the HTML: false for none, full for the entire page, top for the first viewport, or a WIDTHxHEIGHT viewport from 100 to 3840 pixels with an optional -ZOOM percent from 25 to 300, such as 1280x800 or 1920x1080-75. Setting a screenshot also sends browserRendering=true. */
|
|
47
|
+
screenshot?: ScreenshotCapture;
|
|
49
48
|
}
|
|
50
|
-
export interface MarkdownOptions extends
|
|
51
|
-
/**
|
|
52
|
-
|
|
49
|
+
export interface MarkdownOptions extends PageOptions, LoadingOptions {
|
|
50
|
+
/** Scraper action that routes the request or simply flags it, useful for separating analytics per domain. */
|
|
51
|
+
action?: string;
|
|
53
52
|
}
|
|
54
|
-
export interface ScreenshotOptions extends PageOptions
|
|
55
|
-
/** Screenshot area to capture: full for the entire
|
|
56
|
-
screenshot?:
|
|
57
|
-
/** Whether to include the page HTML in the response. */
|
|
58
|
-
html?: boolean;
|
|
59
|
-
/** Whether to include the page Markdown in the response. */
|
|
60
|
-
markdown?: boolean;
|
|
53
|
+
export interface ScreenshotOptions extends PageOptions {
|
|
54
|
+
/** Screenshot area to capture: full for the entire scroll height, top for the first viewport, or a WIDTHxHEIGHT viewport from 100 to 3840 pixels with an optional -ZOOM percent from 25 to 300, such as 1280x800 or 1920x1080-75. */
|
|
55
|
+
screenshot?: ScreenshotArea;
|
|
61
56
|
}
|
|
62
|
-
export interface JsonOptions extends PageOptions {
|
|
57
|
+
export interface JsonOptions extends PageOptions, LoadingOptions {
|
|
63
58
|
/** Instructions describing the data to extract. Append Json Schema: and a JSON schema to shape the output. */
|
|
64
59
|
prompt?: string;
|
|
65
|
-
/** Whether to render the page in a browser before returning the result. */
|
|
66
|
-
browserRendering?: boolean;
|
|
67
60
|
/** Whether to include the page HTML in the response. */
|
|
68
61
|
html?: boolean;
|
|
69
62
|
/** Whether to include a base64 screenshot in the response. */
|
|
@@ -112,12 +105,12 @@ export declare function status<T = unknown>(options?: StatusOptions): Promise<Mr
|
|
|
112
105
|
* @param options Service options and authentication.
|
|
113
106
|
*/
|
|
114
107
|
export declare function scrapeHtml<T = PageData>(url: string, options?: HtmlOptions): Promise<MrScraperResponse<T>>;
|
|
115
|
-
/** Retrieve a page as Markdown.
|
|
108
|
+
/** Retrieve a page as clean Markdown. Browser rendering is optional.
|
|
116
109
|
* @param url Absolute HTTP or HTTPS URL of the page to process.
|
|
117
110
|
* @param options Service options and authentication.
|
|
118
111
|
*/
|
|
119
112
|
export declare function scrapeMarkdown<T = PageData>(url: string, options?: MarkdownOptions): Promise<MrScraperResponse<T>>;
|
|
120
|
-
/** Capture a base64 screenshot of the full page or
|
|
113
|
+
/** Capture a base64 PNG screenshot of the full page, the first viewport, or a custom viewport. Browser rendering is always enabled.
|
|
121
114
|
* @param url Absolute HTTP or HTTPS URL of the page to process.
|
|
122
115
|
* @param options Service options and authentication.
|
|
123
116
|
*/
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK7C;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;gBAExB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAK7C;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM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,CAiB/B"}
|
package/dist/api.js
CHANGED
|
@@ -102,6 +102,11 @@ export async function status(options = {}) {
|
|
|
102
102
|
].includes(key.toLowerCase()))),
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
+
const MAX_TIMEOUT_SECONDS = 330;
|
|
106
|
+
const MAX_SELECTOR_LENGTH = 500;
|
|
107
|
+
// Seven days, the oldest cached result the Scraper API serves.
|
|
108
|
+
const MAX_CACHE_AGE_MS = 604800000;
|
|
109
|
+
const SCREENSHOT_VIEWPORT = /^(\d{3,4})x(\d{3,4})(?:-(\d{2,3}))?$/;
|
|
105
110
|
function integer(name, value, min, max = Number.MAX_SAFE_INTEGER) {
|
|
106
111
|
if (!Number.isSafeInteger(value) || value < min || value > max)
|
|
107
112
|
throw new RangeError(`${name} must be an integer from ${min} to ${max}`);
|
|
@@ -112,6 +117,15 @@ function text(name, value) {
|
|
|
112
117
|
throw new TypeError(`${name} must be a non-empty string`);
|
|
113
118
|
return value.trim();
|
|
114
119
|
}
|
|
120
|
+
function optionalText(name, value) {
|
|
121
|
+
return value === undefined ? undefined : text(name, value);
|
|
122
|
+
}
|
|
123
|
+
function selector(value) {
|
|
124
|
+
const result = optionalText("waitForSelector", value);
|
|
125
|
+
if (result !== undefined && [...result].length > MAX_SELECTOR_LENGTH)
|
|
126
|
+
throw new RangeError(`waitForSelector must be at most ${MAX_SELECTOR_LENGTH} characters`);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
115
129
|
function pageUrl(value) {
|
|
116
130
|
let parsed;
|
|
117
131
|
try {
|
|
@@ -134,33 +148,81 @@ function boolean(name, value) {
|
|
|
134
148
|
throw new TypeError(`${name} must be a boolean`);
|
|
135
149
|
return value;
|
|
136
150
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
const
|
|
151
|
+
/** Whether a value is full, top, or a WIDTHxHEIGHT viewport with an optional -ZOOM. */
|
|
152
|
+
function isScreenshotArea(value) {
|
|
153
|
+
if (value === "full" || value === "top")
|
|
154
|
+
return true;
|
|
155
|
+
const match = typeof value === "string" ? SCREENSHOT_VIEWPORT.exec(value) : null;
|
|
156
|
+
if (!match)
|
|
157
|
+
return false;
|
|
158
|
+
const width = Number(match[1]);
|
|
159
|
+
const height = Number(match[2]);
|
|
160
|
+
const zoom = match[3] === undefined ? 100 : Number(match[3]);
|
|
161
|
+
return (width >= 100 &&
|
|
162
|
+
width <= 3840 &&
|
|
163
|
+
height >= 100 &&
|
|
164
|
+
height <= 3840 &&
|
|
165
|
+
zoom >= 25 &&
|
|
166
|
+
zoom <= 300);
|
|
167
|
+
}
|
|
168
|
+
const SCREENSHOT_AREA_HINT = "WIDTHxHEIGHT from 100 to 3840 pixels with an optional -ZOOM from 25 to 300, such as 1280x800 or 1920x1080-75";
|
|
169
|
+
/** Scrape HTML screenshot: false, full, top, or a custom viewport. */
|
|
170
|
+
function screenshotCapture(value) {
|
|
171
|
+
if (value === false || isScreenshotArea(value))
|
|
172
|
+
return value;
|
|
173
|
+
throw new TypeError(`screenshot must be false, full, top, or ${SCREENSHOT_AREA_HINT}`);
|
|
174
|
+
}
|
|
175
|
+
/** Get screenshot area: full, top, or a custom viewport. */
|
|
176
|
+
function screenshotArea(value) {
|
|
177
|
+
if (isScreenshotArea(value))
|
|
178
|
+
return value;
|
|
179
|
+
throw new TypeError(`screenshot must be full, top, or ${SCREENSHOT_AREA_HINT}`);
|
|
180
|
+
}
|
|
181
|
+
/** Drop omitted fields; explicit false and 0 are sent. */
|
|
182
|
+
function compact(fields) {
|
|
183
|
+
const params = {};
|
|
184
|
+
for (const [key, value] of Object.entries(fields))
|
|
185
|
+
if (value !== undefined)
|
|
186
|
+
params[key] = value;
|
|
187
|
+
return params;
|
|
188
|
+
}
|
|
189
|
+
function pageFields(url, options) {
|
|
190
|
+
const { timeout = 300, waitForSelector, geoCode, maxAge = 0, maxRetries, } = options;
|
|
191
|
+
return {
|
|
142
192
|
url: pageUrl(url),
|
|
143
|
-
timeout: integer("timeout", timeout, 1,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
193
|
+
timeout: integer("timeout", timeout, 1, MAX_TIMEOUT_SECONDS),
|
|
194
|
+
waitForSelector: selector(waitForSelector),
|
|
195
|
+
geoCode: geoCode === undefined ? undefined : country("geoCode", geoCode),
|
|
196
|
+
maxAge: integer("maxAge", maxAge, 0, MAX_CACHE_AGE_MS),
|
|
197
|
+
maxRetries: maxRetries === undefined
|
|
198
|
+
? undefined
|
|
199
|
+
: integer("maxRetries", maxRetries, 0),
|
|
149
200
|
};
|
|
150
|
-
if (proxy !== undefined)
|
|
151
|
-
params.proxy = text("proxy", proxy);
|
|
152
|
-
if (maxRetries !== undefined)
|
|
153
|
-
params.maxRetries = integer("maxRetries", maxRetries, 0);
|
|
154
|
-
return params;
|
|
155
201
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
202
|
+
function loadingFields(options) {
|
|
203
|
+
return {
|
|
204
|
+
browserRendering: options.browserRendering === undefined
|
|
205
|
+
? undefined
|
|
206
|
+
: boolean("browserRendering", options.browserRendering),
|
|
207
|
+
warmStart: boolean("warmStart", options.warmStart ?? false),
|
|
158
208
|
blockResources: boolean("blockResources", options.blockResources ?? false),
|
|
159
|
-
returnCookie: boolean("returnCookie", options.returnCookie ?? false),
|
|
160
209
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
210
|
+
}
|
|
211
|
+
/** Shared page and loading fields in the documented request order. */
|
|
212
|
+
function sharedFields(page, loading = {}, action) {
|
|
213
|
+
return {
|
|
214
|
+
browserRendering: loading.browserRendering,
|
|
215
|
+
timeout: page.timeout,
|
|
216
|
+
warmStart: loading.warmStart,
|
|
217
|
+
blockResources: loading.blockResources,
|
|
218
|
+
waitForSelector: page.waitForSelector,
|
|
219
|
+
action,
|
|
220
|
+
geoCode: page.geoCode,
|
|
221
|
+
// Results are always saved to the dashboard; saveResult is not an option.
|
|
222
|
+
saveResult: true,
|
|
223
|
+
maxAge: page.maxAge,
|
|
224
|
+
maxRetries: page.maxRetries,
|
|
225
|
+
};
|
|
164
226
|
}
|
|
165
227
|
function endpoint(params) {
|
|
166
228
|
const result = new URL(process.env.MRSCRAPER_FETCH_BASE_URL || "https://api.mrscraper.com");
|
|
@@ -177,52 +239,50 @@ async function get(params, options, timeout) {
|
|
|
177
239
|
* @param options Service options and authentication.
|
|
178
240
|
*/
|
|
179
241
|
export async function scrapeHtml(url, options = {}) {
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
242
|
+
const page = pageFields(url, options);
|
|
243
|
+
const loading = loadingFields(options);
|
|
244
|
+
const screenshot = screenshotCapture(options.screenshot ?? false);
|
|
245
|
+
// A screenshot needs a rendered page, so it always sends browserRendering=true.
|
|
246
|
+
if (screenshot !== false)
|
|
247
|
+
loading.browserRendering = true;
|
|
248
|
+
const params = compact({
|
|
249
|
+
url: page.url,
|
|
185
250
|
html: true,
|
|
186
251
|
markdown: false,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
252
|
+
...sharedFields(page, loading, optionalText("action", options.action)),
|
|
253
|
+
screenshot,
|
|
254
|
+
});
|
|
255
|
+
return get(params, options, page.timeout + 30);
|
|
190
256
|
}
|
|
191
|
-
/** Retrieve a page as Markdown.
|
|
257
|
+
/** Retrieve a page as clean Markdown. Browser rendering is optional.
|
|
192
258
|
* @param url Absolute HTTP or HTTPS URL of the page to process.
|
|
193
259
|
* @param options Service options and authentication.
|
|
194
260
|
*/
|
|
195
261
|
export async function scrapeMarkdown(url, options = {}) {
|
|
196
|
-
const
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
...pageParams(url, options),
|
|
200
|
-
...loadingParams(options),
|
|
201
|
-
browserRendering: html || browserRendering,
|
|
202
|
-
warmStart: boolean("warmStart", options.warmStart ?? false),
|
|
203
|
-
html,
|
|
262
|
+
const page = pageFields(url, options);
|
|
263
|
+
const params = compact({
|
|
264
|
+
url: page.url,
|
|
204
265
|
markdown: true,
|
|
266
|
+
html: false,
|
|
205
267
|
screenshot: false,
|
|
206
|
-
|
|
207
|
-
|
|
268
|
+
...sharedFields(page, loadingFields(options), optionalText("action", options.action)),
|
|
269
|
+
});
|
|
270
|
+
return get(params, options, page.timeout + 30);
|
|
208
271
|
}
|
|
209
|
-
/** Capture a base64 screenshot of the full page or
|
|
272
|
+
/** Capture a base64 PNG screenshot of the full page, the first viewport, or a custom viewport. Browser rendering is always enabled.
|
|
210
273
|
* @param url Absolute HTTP or HTTPS URL of the page to process.
|
|
211
274
|
* @param options Service options and authentication.
|
|
212
275
|
*/
|
|
213
276
|
export async function getScreenshot(url, options = {}) {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
browserRendering: true,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
markdown: boolean("markdown", options.markdown ?? false),
|
|
224
|
-
};
|
|
225
|
-
return get(params, options, Number(params.timeout) + 30);
|
|
277
|
+
const page = pageFields(url, options);
|
|
278
|
+
const params = compact({
|
|
279
|
+
url: page.url,
|
|
280
|
+
screenshot: screenshotArea(options.screenshot === undefined ? "full" : options.screenshot),
|
|
281
|
+
html: false,
|
|
282
|
+
markdown: false,
|
|
283
|
+
...sharedFields(page, { browserRendering: true }),
|
|
284
|
+
});
|
|
285
|
+
return get(params, options, page.timeout + 30);
|
|
226
286
|
}
|
|
227
287
|
/** Extract structured JSON from a page using a natural-language prompt. Append Json Schema: and a JSON schema to shape the output.
|
|
228
288
|
* @param url Absolute HTTP or HTTPS URL of the page to process.
|
|
@@ -231,16 +291,19 @@ export async function getScreenshot(url, options = {}) {
|
|
|
231
291
|
export async function scrapeJson(url, options = {}) {
|
|
232
292
|
const prompt = options.prompt ?? DEFAULT_JSON_PROMPT;
|
|
233
293
|
text("prompt", prompt);
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
agent: "general",
|
|
294
|
+
const html = boolean("html", options.html ?? true);
|
|
295
|
+
const screenshot = boolean("screenshot", options.screenshot ?? false);
|
|
296
|
+
const page = pageFields(url, options);
|
|
297
|
+
const params = compact({
|
|
298
|
+
url: page.url,
|
|
240
299
|
prompt,
|
|
241
|
-
|
|
300
|
+
agent: "general",
|
|
301
|
+
html,
|
|
302
|
+
...sharedFields(page, loadingFields(options)),
|
|
303
|
+
screenshot,
|
|
304
|
+
});
|
|
242
305
|
const token = requireToken(options.token);
|
|
243
|
-
const timeout =
|
|
306
|
+
const timeout = page.timeout + 30;
|
|
244
307
|
const getUrl = endpoint(params);
|
|
245
308
|
if (getUrl.length <= 8000)
|
|
246
309
|
return request("GET", getUrl, undefined, authHeaders(token), timeout, token);
|
|
@@ -262,11 +325,13 @@ export async function webSearch(query, options = {}) {
|
|
|
262
325
|
const value = text("query", query);
|
|
263
326
|
if ([...value].length > 1000)
|
|
264
327
|
throw new RangeError("query must be 1 to 1000 characters");
|
|
265
|
-
return get({
|
|
328
|
+
return get(compact({
|
|
266
329
|
action: "websearch",
|
|
267
330
|
query: value,
|
|
268
|
-
country:
|
|
331
|
+
country: options.country === undefined
|
|
332
|
+
? undefined
|
|
333
|
+
: country("country", options.country),
|
|
269
334
|
numResults: integer("numResults", options.numResults ?? 10, 10, 100),
|
|
270
|
-
}, options, 120);
|
|
335
|
+
}), options, 120);
|
|
271
336
|
}
|
|
272
337
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,MAAM,CAAqB;IAEpC,YAAY,OAAe,EAAE,MAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;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,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;KACrE,CAAC,EACF,OAAO,EACP,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { MrScraperError, status, scrapeHtml, scrapeMarkdown, getScreenshot, scrapeBrand, scrapeJson, webSearch, } from "./api.js";
|
|
2
|
-
export type { StatusOptions, PageOptions, LoadingOptions, HtmlOptions, MarkdownOptions, ScreenshotOptions, JsonOptions, BrandOptions, PageData,
|
|
2
|
+
export type { StatusOptions, PageOptions, LoadingOptions, HtmlOptions, MarkdownOptions, ScreenshotOptions, JsonOptions, BrandOptions, PageData, ScreenshotArea, ScreenshotCapture, WebSearchOptions, WebSearchResult, WebSearchResponse, MrScraperResponse, } from "./api.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,aAAa,EACb,WAAW,EACX,cAAc,EACd,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,aAAa,EACb,WAAW,EACX,cAAc,EACd,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,UAAU,CAAC"}
|