1001fx - NoCode functions icon

1001fx - NoCode functions

1001fx is a set of functions for any automation platform. Our functions are simple, very well tested, scalable and offer features that most automation platforms do not offer.

Actions74

data → Scrape HTML

AI-generated

Overview

The Scrape HTML operation under the data resource in this custom n8n node allows users to extract specific information from an HTML string or a website URL using CSS selectors. This is particularly useful for automating data extraction tasks such as web scraping, content aggregation, or monitoring changes on web pages.

Common scenarios:

  • Extracting product details (price, title, image) from e-commerce sites.
  • Collecting article headlines or summaries from news websites.
  • Gathering structured data from any public webpage for further processing in your automation workflows.

Practical example:
You could use this node to scrape all links (<a> tags with href attributes) from a given HTML page and output them as structured JSON for downstream processing.


Properties

Name Meaning
HTML String HTML string to be scraped. Use this if you already have the HTML content and do not need to fetch it from a live website.
Website Website to be scraped. Provide a full URL; the node will fetch the HTML content from this address.
Selectors Input Mode Choose how to provide selectors:
- Expression: Supply selectors as a JSON array.
- Manual: Add selectors one by one via UI fields.
Selectors (Expression) Array of selectors to search for (JSON array). Used when "Selectors Input Mode" is set to "Expression".
Selectors (Manual) List of selector entries, each with:
• Selector: The CSS selector to search for.
• Attribute: The attribute to return (e.g., href, src, text).
• Key Field: The field name for the extracted value.

Output

  • The output is a JSON object containing the extracted data based on the provided selectors.
  • Each key in the output corresponds to the "Key Field" specified in the selector configuration, and its value is the extracted content (attribute value or text) from the matched element(s).
  • If multiple selectors are used, the output will include multiple fields accordingly.

Example output:

{
  "title": "Example Page Title",
  "mainLink": "https://example.com",
  "imageSrc": "https://example.com/image.jpg"
}
  • The node does not output binary data for this operation.

Dependencies

  • External Service: Requires access to the 1001fx API.
  • API Key: You must configure the 1001fxApi credential in n8n.
  • Network Access: The n8n instance must be able to reach external URLs if scraping live websites.

Troubleshooting

Common issues:

  • Invalid Selectors: If a selector does not match any elements, the corresponding field may be empty or missing in the output.
  • Malformed HTML: Supplying invalid HTML in the "HTML String" property can result in incomplete or incorrect extraction.
  • Network Errors: When scraping a website, network issues or inaccessible URLs will cause errors.
  • Authentication Required: Scraping protected or login-required pages will fail unless proper authentication is handled upstream.

Error messages:

  • "error": "Request failed with status code 404" – The target website was not found. Check the URL.
  • "error": "Invalid JSON in selectors" – The selectors input is not valid JSON. Double-check your input format.
  • "error": "Missing required parameter" – Ensure all required properties are filled.

Resolution tips:

  • Always test your selectors using browser dev tools before using them in the node.
  • For large or complex pages, consider limiting the number of selectors or refining them for better performance.

Links and References

Discussion