def clean_url(url):
    """Convert user input URL to clean URL."""
    if url.endswith('/api/'):
        url = url[:-5]
    elif url.endswith('/api'):
        url = url[:-4]
    elif url.endswith('/'):
        url = url[:-1]
    return url
