Letter P

python-tldextract - Accurately separate the TLD from the registered domain andsubdomains of a URL, using the Public Suffix List.

Website: https://github.com/john-kurkowski/tldextract
License: BSD License
Vendor: John Kurkowski <john.kurkowski@gmail.com>
`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])
    >>> # a common alias
    >>> ext.registered_domain


python-tldextract-1.7.2-1.src [122 KiB] (no changelog entry)
python-tldextract-1.7.2-1.noarch [67 KiB] (no changelog entry)

Listing created by Repoview-0.6.6-4.el7