Beispiel #1
0
def urlDomainSplitter(URL):
    if "http" in URL:
        # add artificial slash for cases that don't already have one at the end:
        # e.g., http://www.example.com
        URL = URL + "/"
        index = URL.index("//") + 2
        domain = stringparser.splitRightAspect_toSubstring(URL, index, "/")
        return URL[0:index] + domain
    elif "www." in URL:
        # add artificial slash for cases that don't already have one at the end
        URL = URL + "/"
        index = URL.index("www.") + 4
        domain = stringparser.splitRightAspect_toSubstring(URL, index, "/")
        return URL[0:index] + domain
    else:
        urlBareMinimum(URL)
Beispiel #2
0
def urlDomainSplitter(URL):
    if "http" in URL:
        # add artificial slash for cases that don't already have one at the end: 
        # e.g., http://www.example.com
        URL = URL + "/"
        index = URL.index("//") + 2
        domain = stringparser.splitRightAspect_toSubstring(URL, index, "/")
        return URL[0:index] + domain
    elif "www." in URL:
        # add artificial slash for cases that don't already have one at the end
        URL = URL + "/"
        index = URL.index("www.") + 4
        domain = stringparser.splitRightAspect_toSubstring(URL, index, "/")
        return URL[0:index] + domain
    else:
        urlBareMinimum(URL)
Beispiel #3
0
def urlBareMinimum(URL):
    # add artificial slash for cases that don't already have one at the end
    URL = URL + "/"
    temp = ""
    domain = stringparser.splitRightAspect_toSubstring(URL, 0, "/")
    for a in arr:
        if a in domain:
            return domain
    return "failed"
Beispiel #4
0
def urlBareMinimum(URL):
        # add artificial slash for cases that don't already have one at the end
        URL = URL + "/"
        temp = ""
        domain = stringparser.splitRightAspect_toSubstring(URL, 0, "/")
        for a in arr:
            if a in domain:
                return domain
        return "failed"