Skip to main content

The tldextract module accurately separates the gTLD and ccTLDs from the registered domain and subdomains of a URL. For example, you may want the ‘www.google’ part of http://www.google.com. This is simple to do by splitting on the ‘.’ and using all but the last split element, however that will not work for URLs with arbitrary numbers of subdomains and country codes, unless you know what all country codes look like. Think http://forums.bbc.co.uk for example.

tldextract can give you the subdomains, domain, and gTLD/ccTLD component of a URL, because it looks up–and caches locally–the currently living TLDs according to iana.org.

>>> import tldextract
>>> ext = tldextract.extract('http://forums.news.cnn.com/')
>>> ext['subdomain'], ext['domain'], ext['tld']
('forums.news', 'cnn', 'com')
>>> ext = tldextract.extract('http://forums.bbc.co.uk/')
>>> ext['subdomain'], ext['domain'], ext['tld']
('forums', 'bbc', 'co.uk')

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tldextract-0.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file tldextract-0.1.tar.gz.

File metadata

  • Download URL: tldextract-0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tldextract-0.1.tar.gz
Algorithm Hash digest
SHA256 9b6095ffd073da7593f7c624dcf24bfbba0e07a6ca2fcfa268fb140b073d0ade
MD5 27e050e2e2037bc4d59d1cf52c3944e8
BLAKE2b-256 90bbf366fca33da1e33d38ad4b355b8d33b7efb85b5bc7305b73833e9966220d

See more details on using hashes here.

Release history Release notifications | RSS feed

5.3.2

2 files

5.3.1

2 files

5.3.0

2 files

5.2.0

2 files

5.1.3

2 files

5.1.2

2 files

5.1.1

2 files

5.1.0

2 files

5.0.1

2 files

5.0.0

2 files

4.0.0

2 files

3.6.0

2 files

3.5.0

2 files

3.4.4

2 files

3.4.3

2 files

3.4.2

2 files

3.4.1

2 files

3.4.0

2 files

3.3.1

2 files

3.3.0

2 files

3.2.1

2 files

3.2.0

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

1 file

2.0.0

1 file

1.7.5

1 file

1.7.4

1 file

1.7.3

1 file

1.7.2

1 file

1.7.1

1 file

1.7

1 file

1.6

1 file

1.5.1

1 file

1.5

1 file

1.4

1 file

1.3.1

1 file

1.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1

1 file

1.0

1 file

0.4

1 file

0.3.2

1 file

0.3.1

1 file

0.3

1 file

0.2

1 file

0.1.1

1 file

This release

0.1 This release

1 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