WebScraping.AI icon

WebScraping.AI

AI-powered web scraping with JavaScript rendering and proxies

Get Selected HTML

AI-generated

Summary

Fetches HTML for elements matching a CSS selector on the specified webpage. Sends the request to WebScraping.AI using the required API credentials and returns the response as an n8n item.

Inputs

  • URL (required) — URL of the webpage to scrape.
  • CSS Selector — CSS selector for the target elements; defaults to h1.
  • Additional Options — Optional proxy country, custom JavaScript, custom proxy, device emulation, JavaScript rendering and timeout settings, 404 or redirect error handling, request headers, retrieval timeout, and selector to wait for. Defaults apply where shown in the node UI.
  • Response Format — Choose JSON or text output format; defaults to JSON.

Output shape

One n8n item per input item, containing a json object.

JSON responses are parsed into the output object. Text, HTML, or XML responses are returned as { "data": ... }; other response types are also placed in data. If response JSON cannot be parsed, the body is returned as { "raw": ... }. With Continue On Fail enabled, request errors are returned as { "error": ... }.

Examples

Example 1: Extract the main heading from a page

Set the URL to the target webpage and leave the CSS Selector at its default value, h1. The operation returns the selected content in the configured response format.

Links

Discussion