def get_domain_url(url):
    """
    Use this to convert a url like this:
    https://blog.xkcd.com/2014/07/22/what-if-book-tour/
    Into this:
    https://blog.xkcd.com
    """
    if "http://" not in url and "https://" not in url:
        return url
    url_header = url.split('://')[0]
    simple_url = url.split('://')[1]
    base_url = simple_url.split('/')[0]
    domain_url = url_header + '://' + base_url
    return domain_url
def get_domain_url ( url ) : if "http://" not in url and "https://" not in url : return url url_header = url . split ( '://' ) [ 0 ] simple_url = url . split ( '://' ) [ 1 ] base_url = simple_url . split ( '/' ) [ 0 ] domain_url = url_header + '://' + base_url return domain_url
Use this to convert a url like this:
    https://blog.xkcd.com/2014/07/22/what-if-book-tour/
    Into this:
    https://blog.xkcd.com