You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just try to make a script to find out whether a domain make use of ccTLD, and differentiate between public or private domains.
So I initiate 2 explicit tldextract class that deal with this with explicit include_psl_private_domains switch. However, I notice the class behave differently if you "trigger" the extract ASAP than later on.
Code #1 show include_psl_private_domains=True works if I "test" the class function immediately.
# Trigger the extract immeidately
import tldextract
url = "www.blogspot.co.za"
expub = tldextract.TLDExtract(include_psl_private_domains=False)
expub.update()
expub(url)
# result : ExtractResult(subdomain='www', domain='blogspot', suffix='co.za')
expri = tldextract.TLDExtract(include_psl_private_domains=True)
expri.update()
expri(url)
# result : ExtractResult(subdomain='', domain='www', suffix='blogspot.co.za')
url2 = "another.blogspot.co.uk"
expub(url2)
# result : ExtractResult(subdomain='another', domain='blogspot', suffix='co.uk')
expri(url2)
# result : ExtractResult(subdomain='', domain='another', suffix='blogspot.co.uk')
In following code, include_psl_private_domains=True doesn't work as intended
import tldextract
url = "www.blogspot.co.za"
expub = tldextract.TLDExtract(include_psl_private_domains=False)
expub.update()
expri = tldextract.TLDExtract(include_psl_private_domains=True)
expri.update()
expub(url)
# result : ExtractResult(subdomain='www', domain='blogspot', suffix='co.za')
expri(url)
# result : ExtractResult(subdomain='www', domain='blogspot', suffix='co.za')
# Try another domain
url2 = "another.blogspot.co.uk"
expub(url2)
# result : ExtractResult(subdomain='another', domain='blogspot', suffix='co.uk')
expri(url2)
# result : ExtractResult(subdomain='another', domain='blogspot', suffix='co.uk')
The text was updated successfully, but these errors were encountered:
I just try to make a script to find out whether a domain make use of ccTLD, and differentiate between public or private domains.
So I initiate 2 explicit tldextract class that deal with this with explicit include_psl_private_domains switch. However, I notice the class behave differently if you "trigger" the extract ASAP than later on.
Code #1 show include_psl_private_domains=True works if I "test" the class function immediately.
In following code, include_psl_private_domains=True doesn't work as intended
The text was updated successfully, but these errors were encountered: