Library to work against complex domain names, subdomains and URIs
82
Build a URL classification tool that analyzes website URLs to determine their top-level domain (TLD) type and categorize them for reporting purposes.
Your tool should process a list of URLs and extract their public suffixes (TLDs) to generate classification reports.
Implement a URL classifier that:
Your function should accept an array of URL strings. URLs may include:
Return an object with the following structure:
icannTlds: An object mapping ICANN TLD names to their countsprivateTlds: An object mapping private suffix names to their countsunclassified: An array of URLs that could not be classifiedHandle the following scenarios:
unclassified arrayunclassified array@generates
/**
* Classifies URLs by their public suffix (TLD) type.
*
* @param {string[]} urls - Array of URLs to classify
* @returns {Object} Classification results with icannTlds, privateTlds, and unclassified
*/
function classifyUrls(urls) {
// IMPLEMENTATION HERE
}
module.exports = { classifyUrls };Provides URL parsing and public suffix extraction capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-tldtsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10