MCPcopy Create free account
hub / github.com/chasingboy/Xtools / select_rootdomain

Function select_rootdomain

utils.py:210–219  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

208
209
210def select_rootdomain(text):
211 dms = text.split('.')
212 if len(dms) == 2:
213 return text
214 if dms[-2] in top_sufix and dms[-1] in country_sufix:
215 root = "{0}.{1}.{2}".format(dms[-3],dms[-2],dms[-1])
216 return root
217 if dms[-1] in top_sufix or dms[-1] in country_sufix:
218 root = "{0}.{1}".format(dms[-2],dms[-1])
219 return root
220
221
222def select_urls(view, path=False):

Callers 1

select_domainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected