import sqlite3


def url_exists(urls: str, p_urls: sqlite3.Cursor):
    """Check URL(s) already exist(s) or not.

    Args:
        urls: URL(s) from the user input
        p_urls: URL(s) in the db

    Return:
        List of already existed URL(s)
    """

    match = []
    for p_url in p_urls:
        for url in urls.split(","):
            if p_url[0] == url.strip("/"):
                match.append(url)

    return match