From 6b631f9f93df79acc1fb3da36cd31a2e2378b383 Mon Sep 17 00:00:00 2001 From: Marcin Ulikowski Date: Tue, 31 Oct 2023 20:45:07 +0100 Subject: [PATCH] Added proxy support to HeadlessBrowser() --- dnstwist.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dnstwist.py b/dnstwist.py index 10973fc2..d7b1fef5 100755 --- a/dnstwist.py +++ b/dnstwist.py @@ -445,6 +445,10 @@ def __init__(self, useragent=None): chrome_options = webdriver.ChromeOptions() for opt in self.WEBDRIVER_ARGUMENTS: chrome_options.add_argument(opt) + proxies = urllib.request.getproxies() + if proxies: + proxy_string = ';'.join(['{}={}'.format(scheme, url) for scheme, url in proxies.items()]) + chrome_options.add_argument('--proxy-server={}'.format(proxy_string)) chrome_options.add_experimental_option('excludeSwitches', ['enable-automation']) chrome_options.add_experimental_option('useAutomationExtension', False) self.driver = webdriver.Chrome(options=chrome_options)