Skip to main content

tldextract accurately separates the gTLD or ccTLD (generic or country code top-level domain) from the registered domain and subdomains of a URL.

>>> import tldextract
>>> tldextract.extract('http://forums.news.cnn.com/')
ExtractResult(subdomain='forums.news', domain='cnn', suffix='com')
>>> tldextract.extract('http://forums.bbc.co.uk/') # United Kingdom
ExtractResult(subdomain='forums', domain='bbc', suffix='co.uk')
>>> tldextract.extract('http://www.worldbank.org.kg/') # Kyrgyzstan
ExtractResult(subdomain='www', domain='worldbank', suffix='org.kg')

ExtractResult is a namedtuple, so it's simple to access the parts you want.

>>> ext = tldextract.extract('http://forums.bbc.co.uk')
>>> (ext.subdomain, ext.domain, ext.suffix)
('forums', 'bbc', 'co.uk')
>>> # rejoin subdomain and domain
>>> '.'.join(ext[:2])
'forums.bbc'
>>> # a common alias
>>> ext.registered_domain
'bbc.co.uk'

By default, this package supports the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.

Release files for tldextract 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tldextract 3.1.0
File Size Uploaded
tldextract-3.1.0.tar.gz 101.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tldextract 3.1.0
File Interpreter ABI Platform
tldextract-3.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 188.9 kB

Release files / tldextract-3.1.0.tar.gz

Download URL tldextract-3.1.0.tar.gz
Size 101.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cfae9bc8bda37c3e8c7c8639711ad20e95dc85b207a256b60b0b23d7ff5540ea
BLAKE2b-256 checksum
How to use checksums
429c0340ebfabfbbb3a2868eaa1039479688ca52e1d7f433df4fae638941377f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / tldextract-3.1.0-py2.py3-none-any.whl

Download URL tldextract-3.1.0-py2.py3-none-any.whl
Size 87.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e57f22b6d00a28c21673d2048112f1bdcb6a14d4711568305f6bb96cf5bb53a1
BLAKE2b-256 checksum
How to use checksums
7e62b6acd3129c5615b9860e670df07fd55b76175b63e6b7f68282c7cad38e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

5.3.2

2 release files

5.3.1

2 release files

5.3.0

2 release files

5.2.0

2 release files

5.1.3

2 release files

5.1.2

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.0.0

2 release files

3.5.0

2 release files

3.4.4

2 release files

3.4.3

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.2

2 release files

3.1.1

2 release files

This release

3.1.0 This release

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

1 release file

2.0.0

1 release file

1.7.5

1 release file

1.7.4

1 release file

1.7.3

1 release file

1.7.2

1 release file

1.7.1

1 release file

1.7

1 release file

1.6

1 release file

1.5.1

1 release file

1.5

1 release file

1.4

1 release file

1.3.1

1 release file

1.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

0.4

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page