From f503e1429a2bd751b10e2d301a50c31d5c5c3136 Mon Sep 17 00:00:00 2001 From: Mint <> Date: Sun, 11 Dec 2022 13:38:06 +0300 Subject: [PATCH] Move useragent to config --- config.defaults.json | 3 ++- fetch_blocks.py | 6 +++++- fetch_instances.py | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.defaults.json b/config.defaults.json index d0fe2a9..97a5258 100644 --- a/config.defaults.json +++ b/config.defaults.json @@ -1,4 +1,5 @@ { "base_url": "", - "port": 8069 + "port": 8069, + "useragent": "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0" } diff --git a/fetch_blocks.py b/fetch_blocks.py index 31e3f72..9c9ee45 100644 --- a/fetch_blocks.py +++ b/fetch_blocks.py @@ -4,11 +4,15 @@ from hashlib import sha256 import sqlite3 from bs4 import BeautifulSoup from json import dumps +from json import loads import re from time import time +with open("config.json") as f: + config = loads(f.read()) + headers = { - "user-agent": "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0" + "user-agent": config["useragent"] } diff --git a/fetch_instances.py b/fetch_instances.py index d20bd31..7d6f7c8 100644 --- a/fetch_instances.py +++ b/fetch_instances.py @@ -4,6 +4,9 @@ import sqlite3 import sys import json +with open("config.json") as f: + config = json.loads(f.read()) + domain = sys.argv[1] blacklist = [ @@ -13,7 +16,7 @@ blacklist = [ ] headers = { - "user-agent": "Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Firefox/102.0" + "user-agent": config["useragent"] } -- 2.39.5