mirror of
https://codeberg.org/gigirassy/tiny-utils/
synced 2026-08-30 23:27:40 +00:00
Add check/check
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
#!/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")
|
||||
Reference in New Issue
Block a user