From 348301f201651c7ebc04db2cfbee8f9ebaa5c1ea Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 28 Jun 2020 12:03:23 +0200 Subject: [PATCH] Added bang operator list generator This is, again, just a proof of concept. --- gen_ops.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gen_ops.py diff --git a/gen_ops.py b/gen_ops.py new file mode 100644 index 0000000..6ecedb6 --- /dev/null +++ b/gen_ops.py @@ -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']])