Skip to content

Commit 9bfec03

Browse files
committed
fix(mrscraper): route html-only scrapes through the fetch endpoint
- send HTML-only and screenshot-only scrapes as GET with the target URL in the query; the fetch endpoint replays the request method, so a POST fails on sites that reject it - read raw text/html responses and take token usage from response headers - send screenshot=full and detect PNG vs JPEG from the returned image - keep the API key out of the query string - report the requested search page; the SERP API returns current_page 1 for every page - show retry and token-cap fields only for Markdown requests - use defaultValue for switch defaults - regenerate the integration catalog, tool metadata, block names, and docs manifest
1 parent 44b277c commit 9bfec03

13 files changed

Lines changed: 154 additions & 64 deletions

File tree

‎apps/docs/content/docs/integrations/mrscraper.mdx‎

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
title: MrScraper
33
description: Retrieve web pages, search Google, and check account usage
4+
integration:
5+
type: "mrscraper"
6+
color: "#102C35"
47
---
58

6-
import { BlockInfoCard } from "@/components/ui/block-info-card"
9+
import { ReferenceDetails } from "@/components/ui/reference-details"
710

8-
<BlockInfoCard
9-
type="mrscraper"
10-
color="#102C35"
11-
/>
1211

1312
{/* MANUAL-CONTENT-START:intro */}
1413
Use [MrScraper](https://mrscraper.com) to retrieve a page as HTML, Markdown, or a screenshot, search Google, and check your account's remaining tokens. Use a MrScraper block for a configured workflow step, or connect the [MrScraper MCP server](#connect-the-mcp-server) to give its tools to an Agent.
@@ -25,7 +24,6 @@ You need a [MrScraper account](https://app.mrscraper.com) and an API token for t
2524
The API token authenticates requests. Plan tokens measure MrScraper usage; they are a separate balance. Calls use your MrScraper account's quota and limits.
2625
{/* MANUAL-CONTENT-END */}
2726

28-
2927
## Use the block [#usage-instructions]
3028

3129
{/* MANUAL-CONTENT-START:usage */}
@@ -59,10 +57,12 @@ Retrieve web pages as HTML, Markdown, or screenshots with browser rendering and
5957

6058
## Actions
6159

62-
### mrscraper_scrape
60+
### MrScraper Scrape
6361

6462
Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fallback, optional real-device routing, geolocation, and retry controls.
6563

64+
<ReferenceDetails>
65+
6666
#### Input
6767

6868
| Parameter | Type | Required | Description |
@@ -71,14 +71,14 @@ Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fa
7171
| `url` | string | Yes | Absolute HTTP or HTTPS URL of the page to retrieve. |
7272
| `html` | boolean | No | Include HTML content. Defaults to true. |
7373
| `markdown` | boolean | No | Include Markdown content. |
74-
| `screenshot` | boolean | No | Capture a JPEG screenshot as a stored file. Always enables browser rendering. |
74+
| `screenshot` | boolean | No | Capture a full-page screenshot as a stored file. Always enables browser rendering. |
7575
| `browserRendering` | string | No | auto uses automatic browser fallback; true forces a browser; false disables it. |
7676
| `super` | boolean | No | Use real-device routing independently of browser rendering. |
7777
| `geoCode` | string | No | Proxy country code, such as US, GB, ID, or SG. Defaults to US. |
7878
| `proxyCountry` | string | No | Compatibility country option sent as proxyCountry. |
7979
| `timeout` | number | No | Page timeout in seconds, from 1 to 300. Defaults to 120. |
80-
| `maxRetries` | number | No | Maximum retry count as a nonnegative integer. Zero disables retries. Defaults to 3. |
81-
| `tokenCap` | number | No | Nonnegative retry-token budget. The initial request always runs. |
80+
| `maxRetries` | number | No | Maximum retry count for Markdown requests. Zero disables retries. Defaults to 3. |
81+
| `tokenCap` | number | No | Token budget, at least 1, for a Markdown request and its retries. The initial request always runs. |
8282
| `waitForSelector` | string | No | CSS selector to wait for when browser rendering is enabled. |
8383
| `blockResources` | boolean | No | Block images, CSS, and fonts to reduce bandwidth. |
8484
| `homePage` | boolean | No | Visit the site root before loading the target URL. |
@@ -94,17 +94,21 @@ Retrieve a web page as HTML, Markdown, or a screenshot with automatic browser fa
9494
| --------- | ---- | ----------- |
9595
| `html` | string | Page HTML, when requested. |
9696
| `markdown` | string | Page Markdown, when requested. |
97-
| `screenshot` | file | JPEG screenshot stored in execution files. |
97+
| `screenshot` | file | Page screenshot \(PNG or JPEG\) stored in execution files. |
9898
| `tokenUsage` | number | Plan tokens consumed by the page request. |
9999
| `runtime` | number | Page request runtime in seconds. |
100100
| `retryCount` | number | Number of retries performed. |
101101
| `targetStatusCode` | number | Target page HTTP status from x-status-code. |
102102
| `error` | string | Page retrieval error, when reported by MrScraper. |
103103

104-
### mrscraper_search
104+
</ReferenceDetails>
105+
106+
### MrScraper Search
105107

106108
Search Google from query text or a Google search URL and return organic results, search metadata, pagination, or the raw results-page HTML.
107109

110+
<ReferenceDetails>
111+
108112
#### Input
109113

110114
| Parameter | Type | Required | Description |
@@ -149,7 +153,9 @@ Search Google from query text or a Google search URL and return organic results,
149153
| ↳ `link` | string | Google result-page URL. |
150154
| `tokenUsage` | number | Plan tokens consumed by the search request. |
151155

152-
### mrscraper_get_account
156+
</ReferenceDetails>
157+
158+
### MrScraper Get Account
153159

154160
Check account identity, subscription status, token usage, remaining quota, and rate limits.
155161

@@ -183,17 +189,17 @@ Check account identity, subscription status, token usage, remaining quota, and r
183189

184190
The action tables above describe Sim's outputs. For scraping, `html` and `markdown` contain the requested page content. When requested, `screenshot` is a stored file that you can pass to a later file-compatible block. Request it only when you need an image; screenshots can be large.
185191

186-
Check `targetStatusCode`, `error`, and the returned content before processing a scrape. The target page can return an error or a challenge page even when MrScraper accepted the request. `tokenUsage`, `runtime`, and `retryCount` help explain how the request completed. Format and site behavior determine which content fields are populated.
192+
Check `targetStatusCode`, `error`, and the returned content before processing a scrape. The target page can return an error or a challenge page even when MrScraper accepted the request. `tokenUsage`, `runtime`, and `retryCount` help explain how the request completed. An HTML-only request uses MrScraper's fetch endpoint, which reports `tokenUsage` but leaves `runtime`, `retryCount`, and `targetStatusCode` empty; enable Markdown to get all of them.
187193

188194
For JSON search results, use `searchResults` for organic results, `general` for query metadata, and `pagination` for available result pages. An empty results array is a valid outcome. For HTML search, use the `html` output. These are search results, not a guarantee that each linked page is accessible.
189195

190196
The account action returns a selected summary. API tokens and billing identifiers from the provider's account record are excluded.
191197

192198
## Control time and token usage
193199

194-
Scrape `timeout` is a page-loading timeout in seconds, from `1` to `300`, with a default of `120`. It is separate from workflow execution limits. `maxRetries` defaults to `3`; set it to `0` to disable retries.
200+
Scrape `timeout` is a page-loading timeout in seconds, from `1` to `300`, with a default of `120`. It is separate from workflow execution limits. `maxRetries` and `tokenCap` apply to Markdown requests; the HTML-only fetch endpoint retries on its own. `maxRetries` defaults to `3`; set it to `0` to disable retries.
195201

196-
`tokenCap` stops further retries when the running token total reaches the cap. The first attempt still runs even if it exceeds the cap, so this setting does not guarantee a maximum charge. Web fetching uses runtime and bandwidth: one plan token per 30 seconds and one per 0.25 MB, rounded up for each component. See MrScraper's [Token Plan](https://docs.mrscraper.com/docs/getting-started/api-token) for the maintained calculation.
202+
`tokenCap` must be at least `1` and stops further retries when the running token total reaches the cap. The first attempt still runs even if it exceeds the cap, so this setting does not guarantee a maximum charge. Web fetching uses runtime and bandwidth: one plan token per 30 seconds and one per 0.25 MB, rounded up for each component. See MrScraper's [Token Plan](https://docs.mrscraper.com/docs/getting-started/api-token) for the maintained calculation.
197203

198204
The combined API response must fit Sim's 10 MiB tool response limit, including the screenshot's base64 representation before it is stored as a file. If the response is too large, request fewer formats or omit the screenshot.
199205

‎apps/sim/blocks/blocks/mrscraper.ts‎

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ export const MrScraperBlock: BlockConfig = {
6767
id: 'html',
6868
title: 'Include HTML',
6969
type: 'switch',
70-
value: () => true,
70+
defaultValue: true,
7171
condition: { field: 'operation', value: 'scrape' },
7272
},
7373
{
7474
id: 'markdown',
7575
title: 'Include Markdown',
7676
type: 'switch',
77-
value: () => false,
77+
defaultValue: false,
7878
condition: { field: 'operation', value: 'scrape' },
7979
},
8080
{
8181
id: 'screenshot',
8282
title: 'Capture Screenshot',
8383
type: 'switch',
84-
value: () => false,
84+
defaultValue: false,
8585
condition: { field: 'operation', value: 'scrape' },
8686
},
8787
{
@@ -112,7 +112,7 @@ export const MrScraperBlock: BlockConfig = {
112112
id: 'super',
113113
title: 'Real Device Routing',
114114
type: 'switch',
115-
value: () => false,
115+
defaultValue: false,
116116
condition: { field: 'operation', value: 'scrape' },
117117
mode: 'advanced',
118118
},
@@ -144,15 +144,15 @@ export const MrScraperBlock: BlockConfig = {
144144
id: 'blockResources',
145145
title: 'Block Images, CSS, and Fonts',
146146
type: 'switch',
147-
value: () => false,
147+
defaultValue: false,
148148
condition: { field: 'operation', value: 'scrape' },
149149
mode: 'advanced',
150150
},
151151
{
152152
id: 'homePage',
153153
title: 'Visit Homepage First',
154154
type: 'switch',
155-
value: () => false,
155+
defaultValue: false,
156156
condition: { field: 'operation', value: 'scrape' },
157157
mode: 'advanced',
158158
},
@@ -161,22 +161,30 @@ export const MrScraperBlock: BlockConfig = {
161161
title: 'Maximum Retries',
162162
type: 'short-input',
163163
placeholder: 'Defaults to 3 (0 disables retries)',
164-
condition: { field: 'operation', value: 'scrape' },
164+
condition: {
165+
field: 'operation',
166+
value: 'scrape',
167+
and: { field: 'markdown', value: true },
168+
},
165169
mode: 'advanced',
166170
},
167171
{
168172
id: 'tokenCap',
169173
title: 'Retry Token Budget',
170174
type: 'short-input',
171-
placeholder: 'Enter a nonnegative token budget',
172-
condition: { field: 'operation', value: 'scrape' },
175+
placeholder: 'Enter a token budget of at least 1',
176+
condition: {
177+
field: 'operation',
178+
value: 'scrape',
179+
and: { field: 'markdown', value: true },
180+
},
173181
mode: 'advanced',
174182
},
175183
{
176184
id: 'useProxy',
177185
title: 'Use Proxy',
178186
type: 'switch',
179-
value: () => true,
187+
defaultValue: true,
180188
condition: { field: 'operation', value: 'scrape' },
181189
mode: 'advanced',
182190
},
@@ -201,7 +209,7 @@ export const MrScraperBlock: BlockConfig = {
201209
id: 'bypassProxy',
202210
title: 'Bypass Proxy for Resources',
203211
type: 'switch',
204-
value: () => false,
212+
defaultValue: false,
205213
condition: { field: 'operation', value: 'scrape' },
206214
mode: 'advanced',
207215
},
@@ -250,7 +258,7 @@ export const MrScraperBlock: BlockConfig = {
250258
id: 'renderJs',
251259
title: 'Render Search JavaScript',
252260
type: 'switch',
253-
value: () => false,
261+
defaultValue: false,
254262
condition: { field: 'operation', value: 'search' },
255263
mode: 'advanced',
256264
},
@@ -285,8 +293,11 @@ export const MrScraperBlock: BlockConfig = {
285293
waitForSelector: { type: 'string', description: 'CSS selector to wait for' },
286294
blockResources: { type: 'boolean', description: 'Block images, CSS, and fonts' },
287295
homePage: { type: 'boolean', description: 'Visit the homepage before the target page' },
288-
maxRetries: { type: 'number', description: 'Maximum retry count (default 3)' },
289-
tokenCap: { type: 'number', description: 'Nonnegative retry token budget' },
296+
maxRetries: {
297+
type: 'number',
298+
description: 'Maximum retries for Markdown requests (default 3)',
299+
},
300+
tokenCap: { type: 'number', description: 'Token budget for Markdown requests (at least 1)' },
290301
useProxy: { type: 'boolean', description: 'Allow configured proxies (default true)' },
291302
proxy: { type: 'string', description: 'Custom proxy in username:password@host:port form' },
292303
proxyCountry: { type: 'string', description: 'Compatibility proxy country code' },
@@ -302,7 +313,7 @@ export const MrScraperBlock: BlockConfig = {
302313
outputs: {
303314
html: { type: 'string', description: 'Page HTML or raw Google results HTML' },
304315
markdown: { type: 'string', description: 'Page Markdown when requested' },
305-
screenshot: { type: 'file', description: 'Screenshot stored as a JPEG file when requested' },
316+
screenshot: { type: 'file', description: 'Page screenshot file (PNG or JPEG) when requested' },
306317
tokenUsage: { type: 'number', description: 'Tokens used by the request or account' },
307318
runtime: { type: 'number', description: 'Page retrieval runtime reported by MrScraper' },
308319
retryCount: { type: 'number', description: 'Page retrieval retry count' },

‎apps/sim/lib/block-metadata/names.generated.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export const BLOCK_NAMES: Readonly<Record<string, string>> = {
184184
monday: 'Monday',
185185
mongodb: 'MongoDB',
186186
mothership: 'Sim Chat',
187+
mrscraper: 'MrScraper',
187188
mssql: 'Microsoft SQL Server',
188189
mysql: 'MySQL',
189190
neo4j: 'Neo4j',

‎apps/sim/lib/mothership/generated/docs-manifest.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ export const DOCS_MANIFEST: readonly string[] = [
245245
'integrations/monday-service-account.mdx',
246246
'integrations/monday.mdx',
247247
'integrations/mongodb.mdx',
248+
'integrations/mrscraper.mdx',
248249
'integrations/mssql.mdx',
249250
'integrations/mysql.mdx',
250251
'integrations/neo4j.mdx',

‎apps/sim/tools/generated/tool-ids.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/generated/tool-metadata.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/generated/tool-outputs.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)