HTML+ icon

HTML+

Addtional HTML manipulation features

HTML+

AI-generated

Overview

This node, named "HTML+", provides additional HTML manipulation features within an n8n workflow. Its primary function is to process input HTML content and modify it based on specified actions. Currently, the only supported action is to remove HTML tags that match given CSS selectors. This can be useful in scenarios where you want to clean or filter HTML content by removing unwanted elements such as ads, scripts, or specific sections before further processing or output.

Practical examples include:

  • Cleaning up scraped web page HTML by removing banners or pop-ups.
  • Stripping out certain tags from user-generated HTML content for sanitization.
  • Preparing HTML snippets by removing unnecessary elements before embedding them elsewhere.

Properties

Name Meaning
Action The operation to perform on the HTML. Currently supports: Remove (Remove tags by CSS selectors)
HTML The raw HTML string to be processed
CSS Selector A comma-separated list of CSS selectors specifying which tags to remove (used when Action is Remove)

Output

The node outputs a JSON array where each item contains a single field:

  • html: A string representing the manipulated HTML after applying the specified action(s). For example, if tags matching the CSS selectors were removed, this field contains the cleaned HTML.

No binary data output is produced by this node.

Dependencies

  • This node depends on the cheerio library, a fast, flexible, and lean implementation of core jQuery designed specifically for the server. It is used here to parse and manipulate the HTML content using CSS selectors.
  • No external API keys or services are required.
  • No special environment variables or n8n configurations are needed beyond standard node setup.

Troubleshooting

  • Empty or unchanged output HTML: Ensure that the input HTML is valid and that the CSS selectors provided actually match elements in the HTML. Incorrect or overly specific selectors may result in no changes.
  • Invalid CSS selector error: If the CSS selector syntax is incorrect, the underlying library may throw errors or silently fail to remove elements. Double-check selector syntax.
  • Large HTML inputs: Processing very large HTML strings might impact performance; consider splitting input or optimizing selectors.
  • Missing input properties: The node requires the HTML and CSS Selector fields to be non-empty when the "Remove" action is selected. Omitting these will likely cause errors or no operation.

Links and References

Discussion