Added bang operator list generator

This is, again, just a proof of concept.
main
Marvin Borner 2020-06-28 12:03:23 +02:00
parent 5575bcd0af
commit 348301f201
No known key found for this signature in database
GPG Key ID: EE7C47A7F1E65C4B
1 changed files with 19 additions and 0 deletions

19
gen_ops.py Normal file
View File

@ -0,0 +1,19 @@
import csv, json, sys
import requests
import collections
# Request list
try:
r = requests.get('https://duckduckgo.com/bang.v255.js')
r.raise_for_status()
except requests.exceptions.HTTPError as err:
raise SystemExit(err)
# Convert to json
data = json.loads(r.text)
# Output CSV
output = csv.writer(sys.stdout)
output.writerow(['tag', 'url', 'domain', 'name'])
for row in data:
output.writerow([row['t'], row['u'], row['d'], row['s']])