ScrapeNinja ACTION
Scrape with JS Rendering
Uses the ScrapeNinja real Chrome browser engine to scrape pages that require JS rendering. See the documentation
- Action
- Writes data
- API key
- SDK
- MCP
IMPLEMENTATION
Call this tool
Connect a user's ScrapeNinja account once, then configure and run Scrape with JS Rendering from your backend or agent.
import { PipedreamClient } from "@pipedream/sdk"
const pd = new PipedreamClient({
projectId: process.env.PIPEDREAM_PROJECT_ID!,
clientId: process.env.PIPEDREAM_CLIENT_ID!,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
projectEnvironment: "production",
})
const result = await pd.actions.run({
id: "scrapeninja-scrape-with-js-rendering",
externalUserId: "{external_user_id}", // any stable ID for this user in your system
configuredProps: {
scrapeninja: { authProvisionId: "apn_xxxxxxx" },
url: "URL",
waitForSelector: "Wait For Selector",
},
})
console.log(result)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "scrapeninja-scrape-with-js-rendering",
"configured_props": {
"scrapeninja": { "authProvisionId": "apn_xxxxxxx" },
"url": "URL",
"waitForSelector": "Wait For Selector"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "scrapeninja",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "scrapeninja-scrape-with-js-rendering",
arguments: {
url: "URL",
waitForSelector: "Wait For Selector",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| Property | Type | Description |
|---|---|---|
url URL | string | The URL to scrape. Required |
waitForSelector Wait For Selector | string | CSS selector to wait for before considering the page loaded. Optional |
postWaitTime Post Wait Time | integer | Wait for specified amount of seconds after page load (from 1 to 12s). Use this only if ScrapeNinja failed to wait for required page elements automatically. Optional |
dumpIframe Dump Iframe | string | If some particular iframe needs to be dumped, specify its name HTML value in this argument. The ScrapeNinja JS renderer will wait for CSS selector to wait for iframe DOM elements to appear inside. Optional |
waitForSelectorIframe Wait For Selector Iframe | string | If Dump Iframe is activated, this property allows to wait for CSS selector inside this iframe. Optional |
extractorTargetIframe Extractor Target Iframe | boolean | If Dump Iframe is activated, this property allows to run JS extractor function against iframe HTML instead of running it against base body. This is only useful if Dump Iframe is activated. Optional |
headers Headers | string[] | Custom headers to send with the request. By default, regular Chrome browser headers are sent to the target URL. Optional |
retryNum Retry Number | integer | Amount of attempts. Optional |
geo Geo | string | Geo location for basic proxy pools (you can purchase premium ScrapeNinja proxies for wider country selection and higher proxy quality). Read more about ScrapeNinja proxy setup Optional |
proxy Proxy | string | Premium or your own proxy URL (overrides Geo prop). Read more about ScrapeNinja proxy setup. Optional |
timeout Timeout | integer | Timeout per attempt, in seconds. Each retry will take [timeout] number of seconds. Optional |
textNotExpected Text Not Expected | string[] | Text which will trigger a retry from another proxy address. Optional |
statusNotExpected Status Not Expected | integer[] | HTTP response statuses which will trigger a retry from another proxy address. Optional |
blockImages Block Images | boolean | Block images from loading. This will speed up page loading and reduce bandwidth usage. Optional |
blockMedia Block Media | boolean | Block (CSS, fonts) from loading. This will speed up page loading and reduce bandwidth usage. Optional |
screenshot Screenshot | boolean | Take a screenshot of the page. Pass "false" to increase the speed of the request. Optional |
catchAjaxHeadersUrlMask Catch Ajax Headers URL Mask | string | Useful to dump some XHR response. Pass URL mask here. For example, if you need to catch all requests to https://example.com/api/data.json, pass "api/data.json" here. In response, you will get new property .info.catchedAjax with the XHR response data - { url, method, headers[], body , status, responseHeaders{} } Optional |
viewportWidth Viewport Width | integer | Width of the viewport. Optional |
viewportHeight Viewport Height | integer | Height of the viewport. Optional |
viewportDeviceScaleFactor Viewport Device Scale Factor | integer | Device scale factor for the viewport. Optional |
viewportHasTouch Viewport Has Touch | boolean | Whether the viewport has touch capabilities. Optional |
viewportIsMobile Viewport Is Mobile | boolean | Whether the viewport is mobile. Optional |
viewportIsLandscape Viewport Is Landscape | boolean | Whether the viewport is in landscape mode. Optional |
extractor Extractor | string | Custom JS function to extract JSON values from scraped HTML. Write&test your own extractor on https://scrapeninja.net/cheerio-sandbox/ Optional |
REFERENCE
Tool details
Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.
- Registry key
- scrapeninja-scrape-with-js-rendering
- Version
- 0.0.2
- App
- ScrapeNinja
- Authentication
- API key
- Read-only
- No
- Destructive
- No
- Open world
- Yes
- Source
- View on GitHub ↗