from lollms.config import ASCIIColors from lollms.config import TypedConfig, BaseConfig, ConfigTemplate, InstallOption from lollms.personality import APScript, AIPersonality from lollms.paths import LollmsPaths import urllib.parse import urllib.request import json from urllib.parse import quote from pathlib import Path import subprocess def format_url_parameter(value): encoded_value = value.strip().replace("\"","") return encoded_value def extract_results(url, max_num): from selenium import webdriver from selenium.webdriver.chrome.options import Options from bs4 import BeautifulSoup # Configure Chrome options chrome_options = Options() chrome_options.add_argument("--headless") # Run Chrome in headless mode # Set path to chromedriver executable (replace with your own path) chromedriver_path = "path/to/chromedriver" # Create a new Chrome webdriver instance driver = webdriver.Chrome(executable_path=chromedriver_path, options=chrome_options) # Load the webpage driver.get(url) # Wait for JavaScript to execute and get the final page source html_content = driver.page_source # Close the browser driver.quit() # Parse the HTML content soup = BeautifulSoup(html_content, "html.parser") # Detect that no outputs are found Not_found = soup.find("No results found") if Not_found : return [] # Find the