blob: dbd98b4c8d4e1a46d7c624bd3434c66c7c0f29ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/env python3
import sys
import requests
import validators
if len(sys.argv) > 1:
urls = sys.argv[1:]
else:
urls = sys.stdin.read().splitlines()
if not urls:
sys.exit(2)
for url in urls:
if not validators.url(url):
sys.exit(3)
host = "grapheneos.org"
api_url = "https://api.indexnow.org/indexnow"
with open("indexnow-key.txt") as keyfile:
key = keyfile.read().strip()
def submit(urls):
print(urls)
data = {
"host": host,
"key": key,
"urlList": urls
}
r = requests.post(api_url, json=data)
print(r.status_code)
submit(urls)
|