Fix : searxng now failing gracefully

This commit is contained in:
martin legrand
2025-03-18 12:17:41 +01:00
parent 0616f39e35
commit 372da19f30
4 changed files with 10 additions and 10 deletions
+4 -5
View File
@@ -38,12 +38,10 @@ class Browser:
chrome_options.add_argument("--disable-dev-shm-usage")
# Automatically find ChromeDriver path
chromedriver_path = shutil.which("chromedriver")
if not chromedriver_path:
raise FileNotFoundError("ChromeDriver not found. Please install it or add it to your PATH.")
service = Service(chromedriver_path)
if chromedriver_path:
self.driver = webdriver.Chrome(service=service, options=chrome_options)
else:
self.driver = webdriver.Chrome(service=service)
#raise FileNotFoundError("ChromeDriver not found. Please install it or add it to your PATH.")
self.driver = webdriver.Chrome(service=service, options=chrome_options)
self.wait = WebDriverWait(self.driver, 10)
self.logger = logging.getLogger(__name__)
self.logger.info("Browser initialized successfully")
@@ -115,6 +113,7 @@ class Browser:
return None
def clean_url(self, url):
"""Clean URL to keep only the part needed for navigation to the page"""
clean = url.split('#')[0]
parts = clean.split('?', 1)
base_url = parts[0]