View as Markdown
Scrapfly icon

Scrapfly ACTION

AI Data Extraction

Automate content extraction from any text-based source using AI, LLM, and custom parsing. See the documentation
  • Action
  • Read only
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Scrapfly account once, then configure and run AI Data Extraction 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: "scrapfly-ai-data-extraction",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    scrapfly: { authProvisionId: "apn_xxxxxxx" },
    body: "File Path or URL",
    contentType: "Content Type",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

AI Data Extraction inputs
Property Type Description
body File Path or URL string
The file containing the content of the page you want to extract data from. The content must be in the format specified by Content Type. Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.txt)
Required
contentType Content Type string
Content type of the document pass in the body - You must specify the content type of the document by using this parameter or via the content-type header. This parameter has priority over the content-type header.
Required
url URL string
This URL is used to transform any relative URLs in the document into absolute URLs automatically. It can be either the base URL or the exact URL of the document. Must be url encoded.
Required
charset Charset string
Charset of the document pass in the body. If you are not sure, you can use the auto value and we will try to detect it. Bad charset can lead to bad extraction, so it's important to set it correctly. The most common charset is utf-8 for text document and ascii for binary. The symptom of a bad charset is that the text is not correctly displayed (accent, special characters, etc).
Optional
extractionTemplate Extraction Template string
Define an extraction template to get structured data. Use an ephemeral template (declared on the fly on the API call) or a stored template (declared in the dashboard) by using the template name.
Optional
extractionPrompt Extraction Prompt string
Instruction to extract data or ask a question on the scraped content with an LLM (Large Language Model). Must be url encoded.
Optional
extractionModel Extraction Model string
AI Extraction to auto parse document to get structured data. E.g., product, review, real-estate, article.
Optional
webhookName Webhook Name string
Queue you scrape request and redirect API response to a provided webhook endpoint. You can create a webhook endpoint from your dashboard, it takes the name of the webhook. Webhooks are scoped to the given project/env.
Optional
syncDir SyncDir dir
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
scrapfly-ai-data-extraction
Version
0.1.2
App
Scrapfly
Authentication
API key
Read-only
Yes
Destructive
No
Open world
Yes