Skip to main content

URL Domain Match

Uncontrolled node

Overview

The URL Domain Match node compares two URLs and outputs a boolean indicating whether they share the same domain. This is useful for validating URL sources, filtering web scraping results, or ensuring data consistency when processing links from different origins.

The node uses the tldts library to parse URLs and extract their domain components, handling various URL formats including those with subdomains, paths, and query parameters.

Inputs

InputTypeDescriptionDefault
url1TextThe first URL to compare.-
url2TextThe second URL to compare.-

Outputs

OutputTypeDescription
matchBooleanReturns true if the domains of both URLs match, otherwise returns false.

Runtime Behavior and Defaults

  • Domain Extraction: The node parses both URLs to extract their root domains (e.g., example.com from https://www.example.com/path).
  • Type Safety: If either input is not a valid string, the node outputs false rather than throwing an error.
  • Comparison Logic: The comparison is performed on the parsed domain property. Subdomains are considered part of the domain for matching purposes (e.g., api.example.com and www.example.com would match if comparing domains at the example.com level, though the actual implementation compares the full domain string returned by the parser).
  • No Events: As an uncontrolled node, this node executes immediately when its inputs are available and does not fire or listen to events.

Example Usage

Validating Same-Origin Links Connect two URLs from a web scraping operation to verify they belong to the same website:

url1: "https://blog.company.com/article-1"
url2: "https://shop.company.com/products"

Output:

match: true

Both URLs share the domain company.com, so the node returns true.

Handling Invalid Inputs If either input is not a string:

url1: "https://example.com"
url2: null

Output:

match: false