MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / get_sub_domain_name

Function get_sub_domain_name

web_programming/emails_from_url.py:60–67  ·  view source on GitHub ↗

>>> get_sub_domain_name("https://a.b.c.d/e/f?g=h,i=j#k") 'a.b.c.d' >>> get_sub_domain_name("Not a URL!") ''

(url: str)

Source from the content-addressed store, hash-verified

58
59# Get sub domain name (sub.example.com)
60def get_sub_domain_name(url: str) -> str:
61 """
62 >>> get_sub_domain_name("https://a.b.c.d/e/f?g=h,i=j#k")
63 'a.b.c.d'
64 >>> get_sub_domain_name("Not a URL!")
65 ''
66 """
67 return parse.urlparse(url).netloc
68
69
70def emails_from_url(url: str = "https://github.com") -> list[str]:

Callers 1

get_domain_nameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected