#!/usr/bin/env python3
# to check whether a url has been archived by archivebot
import sys
import requests
from urllib.parse import quote

url_to_query = sys.argv[1]
url = "https://archive.fart.website/archivebot/viewer/?q=" + quote(url_to_query, safe="")

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0"
}

response = requests.get(url, headers=headers, timeout=15)

if "No search results" in response.text:
    print("No search results")
else:
    print("Search results found")