def get_url_and_token(string):
    """ extract url and token from API format """
    try:
        [token, api] = string.split(":", 1)
        [_, _, addr, _, port, proto] = api.split("/", 5)
        url = f"{proto}://{addr}:{port}/rpc/v0"
    except Exception:
        raise ValueError(f"malformed API string : {string}")

    return (url, token)