def resolve_wikipedia_link(link):
    """
    Given a link like [[813 (film)|813]]
    Return the string 813
    """
    link = link.strip()
    # first remove the brackets
    if link.startswith("[[") and link.endswith("]]"):
        link = link.strip()[2:-2]
    # split the link into the title and the link if there is one
    _, link = link.split("|") if "|" in link else (None, link)
    return link.strip()