0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions114

Operator → HTML Parser

AI-generated

Overview

This node performs HTML parsing operations within the 'Operator' resource. It allows users to extract HTML content from a specified URL or directly from an HTML string. Users can specify CSS selectors, tag selectors, class selectors, or ID selectors to target specific elements within the HTML. The node can return either the first matching element or all elements that satisfy the query, making it useful for web scraping, data extraction, and content analysis tasks.

Use Case Examples

  1. Extract all paragraph elements from a webpage by specifying the URL and the tag selector 'p'.
  2. Parse an HTML string to retrieve elements with a specific class name.
  3. Use a CSS selector to extract all elements matching a complex query from a website's HTML content.

Properties

Name Meaning
Code Variables Defines variables that can be used within the code editor for the selected function, allowing dynamic input values.
Url The URL of the website from which to extract the HTML content.
Html An HTML string that can be directly passed instead of a URL to extract content.
All Determines whether to return all elements matching the query (true) or only the first element (false).
Selector A CSS selector string that overrides tagSelector, classSelector, and idSelector to specify elements to extract.
Tag Selector The tag name of elements to extract, such as 'p' or 'div'.
Class Selector The class name of elements to extract.
ID Selector The ID of the element to extract.

Output

JSON

  • extractedElements - The extracted HTML elements matching the specified selectors, either as a single element or an array of elements depending on the 'All' property.

Dependencies

  • Requires an API key credential for the CodeKit API to perform the HTML parsing request.

Troubleshooting

  • If no elements are returned, verify that the URL or HTML string is correct and accessible.
  • Ensure the CSS selector or other selectors are correctly specified to match the desired elements.
  • If the node fails, check that the API key credential is valid and has the necessary permissions.
  • When using code variables, ensure they are properly defined and passed to avoid errors.

Discussion