import requests


def getCidAndTitle(bvid: str, p: int = 1):
    """Get audio title and cid by BV id."""

    url = "https://api.bilibili.com/x/web-interface/view?bvid=" + bvid
    data = requests.get(url).json()["data"]
    title = data["title"]
    cid = data["pages"][p - 1]["cid"]
    return str(cid), title