Scrapfly icon

Scrapfly

Scrapfly data collection APIs for web page scraping, screenshots, and AI data extraction

Extraction → Extract Data From an HTML, Text, or Markdown Document Using AI

AI-generated

Summary

Sends raw HTML, text, or markdown content to Scrapfly's API to extract structured data using AI or JSON templates.

Inputs

  • body (required) — The raw content of the document (HTML, text, markdown, etc.) to be processed.
  • content_type (required) — The MIME type of the content in the body (e.g., text/html, text/markdown, application/).
  • url — Used to automatically convert relative URLs in the document to absolute URLs.
  • charset — Charset of the document. Defaults to 'auto' for automatic detection.
  • extraction_template — A saved template slug (e.g., 'product-card') or an inline JSON extraction template.
  • extraction_prompt — Custom instructions for the AI to extract specific data.
  • extraction_model — Predefined AI extraction model (e.g., product, article, event). Defaults to 'product'.
  • webhook_name — Queues the extraction request and redirects the API response to a specific webhook endpoint.

Output shape

An array of items containing the extracted data (typically JSON) returned by the Scrapfly API.

The exact shape depends on the extraction template or model used; errors are wrapped in a standard n8n NodeApiError.

Examples

Example 1: Extract product details from raw HTML

Set Body to HTML content, Content Type to 'text/html', and Extraction Model to 'product'.

Example 2: Parse a markdown article with custom instructions

Set Body to markdown text, Content Type to 'text/markdown', and Extraction Prompt to 'Extract the title, author, and publication date.'

Links

Discussion