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
| Input | Type | Description | Default |
|---|---|---|---|
| url1 | Text | The first URL to compare. | - |
| url2 | Text | The second URL to compare. | - |
Outputs
| Output | Type | Description |
|---|---|---|
| match | Boolean | Returns 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.comfromhttps://www.example.com/path). - Type Safety: If either input is not a valid string, the node outputs
falserather 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.comandwww.example.comwould match if comparing domains at theexample.comlevel, 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