From: Mint <> Date: Sun, 11 Dec 2022 10:38:06 +0000 (+0300) Subject: Move useragent to config X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f503e1429a2bd751b10e2d301a50c31d5c5c3136;p=fba.git Move useragent to config --- 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"] }