import re


def get_info_from_detail_urls_only(given_cardetail_url):
    """
    Given a car detail URL this will extract details from the URL only (not do a GET)
    :param given_cardetail_url: AT page where full details are shown
    :return: dict
    """
    result = {
        "sales_type": "",
        "car_brand": "",
        "car_model": "",
        "sales_area": "",
        "sales_province": "",
        "url": "",
    }

    url_split_regex = "https://www.autotrader.ca/(a|ico)/(.+?)/(.+?)/(.+?)/(.+?)/"
    m = re.search(url_split_regex, given_cardetail_url)
    if m is not None:
        if len(m.groups()) == 5:
            if m.group(1) == "ico":
                result["sales_type"] = "Private"
            else:
                result["sales_type"] = "Dealer"

            result["car_brand"] = m.group(2).replace("%20", " ").title()
            result["car_model"] = m.group(3).replace("%20", " ").title()
            result["sales_area"] = m.group(4).replace("%20", " ").title()
            result["sales_province"] = m.group(5).replace("%20", " ").title()
            result["url"] = given_cardetail_url.split("?showcpo")[0]

    return result