def get_playlist_id(link: str) -> str:
    """
    Returns a playlist ID given a Spotify playlist URL.
    """

    # first remove the general URL part
    data = link.split("/")[-1]

    # we can safely return the last part if there's no question mark in it,
    # otherwise we need to split it again to remove the "si" code
    return data.split("?")[0] if "?" in data else data[-1]