{"id":18544746,"url":"https://github.com/131/node-tld","last_synced_at":"2025-04-13T08:17:10.916Z","repository":{"id":50011696,"uuid":"55231117","full_name":"131/node-tld","owner":"131","description":"Nodejs TLD extract","archived":false,"fork":false,"pushed_at":"2024-07-17T21:10:19.000Z","size":472,"stargazers_count":44,"open_issues_count":1,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T10:56:34.718Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/131.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-01T12:32:15.000Z","updated_at":"2024-10-28T15:11:49.000Z","dependencies_parsed_at":"2023-01-30T03:45:47.547Z","dependency_job_id":"0f0de171-9160-454b-8f24-9377ceca0b58","html_url":"https://github.com/131/node-tld","commit_stats":{"total_commits":33,"total_committers":4,"mean_commits":8.25,"dds":0.6060606060606061,"last_synced_commit":"0788de84c87cf2cdb7877bf6337400a5e849fa8f"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fnode-tld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fnode-tld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fnode-tld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fnode-tld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/131","download_url":"https://codeload.github.com/131/node-tld/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245755666,"owners_count":20667027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T20:17:28.639Z","updated_at":"2025-03-27T00:07:59.642Z","avatar_url":"https://github.com/131.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Build Status](https://github.com/131/node-tld/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/131/node-tld/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/131/node-tld/badge.svg?branch=master)](https://coveralls.io/github/131/node-tld?branch=master)\n[![Version](https://img.shields.io/npm/v/tld-extract.svg)](https://www.npmjs.com/package/tld-extract)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n[![Code style](https://img.shields.io/badge/code%2fstyle-ivs-green.svg)](https://www.npmjs.com/package/eslint-plugin-ivs)\n\n\n\n\n# Motivation\nExtract the TLD/domain/subdomain parts of an URL/hostname against [mozilla TLDs official listing](https://publicsuffix.org/).\n\n\n# API\n\n```\nvar parser = require('tld-extract');\n\nconsole.log( parser(\"http://www.google.com\") );\nconsole.log( parser(\"http://google.co.uk\") );\n/**\n* \u003e\u003e { tld: 'com', domain: 'google.com', sub: 'www' }\n* \u003e\u003e { tld: 'co.uk', domain: 'google.co.uk', sub: '' }\n*/\n\n```\n## Private TLDs\nPrivate TLDs are supported, see [chromium source code for specs](https://chromium.googlesource.com/chromium/src/+/master/net/tools/tld_cleanup/tld_cleanup.cc)\n\n```\nconsole.log( parser(\"http://jeanlebon.cloudfront.net\"));\n/**\n* \u003e\u003e { tld : 'net', domain : 'cloudfront.net', sub : 'jeanlebon' };\n*/\n\n\nconsole.log( parser(\"http://jeanlebon.cloudfront.net\", {allowPrivateTLD : true}));\n/**\n* \u003e\u003e { tld : 'cloudfront.net', domain : 'jeanlebon.cloudfront.net', sub : '' };\n*/\n```\n\n## Unknown TLDs (level0)\nBy default, unknown TLD throw an exception, you can allow them and use tld-extract as a parser using the `allowUnknownTLD` option\n\n```\n  parse(\"http://nowhere.local\")\n    \u003e\u003e throws /Invalid TLD/\n\n  parse(\"http://nowhere.local\", {allowUnknownTLD : true}))\n    \u003e\u003e { tld : 'local', domain : 'nowhere.local', sub : '' }\n\n```\n\n## DotLess domain\nUsing a tld as a direct domain name, or [dotless domain](https://en.wikipedia.org/wiki/Top-level_domain#Dotless_domains) is highly not recommended (ICANN and IAB have spoken out against the practice, classifying it as a security risk among other concerns.[34] ICANN's Security and Stability Advisory Committee (SSAC) additionally claims that SMTP \"requires at least two labels in the FQDN of a mail address\" and, as such, mail servers would reject emails to addresses with dotless domains), and will throw an error in `tld-extract`. You can override this behavior using the `allowDotlessTLD` option.\n\n\n```\n  parse(\"http://notaires.fr\")\n    \u003e\u003e throws /Invalid TLD/\n\n  parse(\"http://notaires.fr\", {allowDotlessTLD : true}))\n    \u003e\u003e { tld : 'notaires.fr', domain : 'notaires.fr', sub : '' }\n\n```\n\n\n\n\n\n\n# Why\n* no dependencies\n* really fast\n* full code coverage\n* easy to read (10 lines)\n* easily updatable vs mozilla TLDs source list\n* TypeScript support\n\n# Maintenance\nYou can update the remote hash table using `npm run update`\n\n\n# Not Invented Here\n\n* A port of a [yks/PHP library](https://github.com/131/yks/blob/master/class/exts/http/urls.php)\n\n* [tldextract](https://github.com/masylum/tldextract)  =\u003e bad API, (no need for async, \"domain\" property is wrong), no need for dependencies\n* [tld](https://github.com/donpark/node-tld/blob/master/lib/tld.js) =\u003e (nothing bad, a bit outdated )\n* [tld.js](https://github.com/ramitos/tld.js) =\u003e no sane way to prove/trust/update TLD listing\n\n\n# Credits\n* [131](https://github.com/131)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fnode-tld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F131%2Fnode-tld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fnode-tld/lists"}