feat : remove browser message

This commit is contained in:
martin legrand 2025-03-29 18:48:38 +01:00
parent 557f7aa333
commit cc951d4745
3 changed files with 11 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

View File

@ -49,19 +49,22 @@ def create_driver(headless=False):
if headless: if headless:
chrome_options.add_argument("--headless") chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu") chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--disable-webgl")
chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--autoplay-policy=user-gesture-required") chrome_options.add_argument("--autoplay-policy=user-gesture-required")
chrome_options.add_argument("--mute-audio") chrome_options.add_argument("--mute-audio")
chrome_options.add_argument("--disable-webgl")
chrome_options.add_argument("--disable-notifications") chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument('--window-size=1080,560')
security_prefs = { security_prefs = {
"profile.default_content_setting_values.media_stream": 2, "profile.default_content_setting_values.media_stream": 2,
"profile.default_content_setting_values.geolocation": 2, "profile.default_content_setting_values.geolocation": 2,
"safebrowsing.enabled": True, "safebrowsing.enabled": True,
} }
chrome_options.add_experimental_option("prefs", security_prefs) chrome_options.add_experimental_option("prefs", security_prefs)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
chromedriver_path = shutil.which("chromedriver") chromedriver_path = shutil.which("chromedriver")
if not chromedriver_path: if not chromedriver_path:
@ -74,7 +77,7 @@ def create_driver(headless=False):
return webdriver.Chrome(service=service, options=chrome_options) return webdriver.Chrome(service=service, options=chrome_options)
class Browser: class Browser:
def __init__(self, driver, headless=False, anticaptcha_install=True): def __init__(self, driver, anticaptcha_install=True):
"""Initialize the browser with optional headless mode.""" """Initialize the browser with optional headless mode."""
self.js_scripts_folder = "./sources/web_scripts/" if not __name__ == "__main__" else "./web_scripts/" self.js_scripts_folder = "./sources/web_scripts/" if not __name__ == "__main__" else "./web_scripts/"
self.anticaptcha = "https://chrome.google.com/webstore/detail/nopecha-captcha-solver/dknlfmjaanfblgfdfebhijalfmhmjjjo/related" self.anticaptcha = "https://chrome.google.com/webstore/detail/nopecha-captcha-solver/dknlfmjaanfblgfdfebhijalfmhmjjjo/related"

View File

@ -55,7 +55,7 @@ def pretty_print(text, color="info"):
color = "info" color = "info"
print(colored(text, color_map[color])) print(colored(text, color_map[color]))
def animate_thinking(text, color="status", duration=2): def animate_thinking(text, color="status", duration=120):
""" """
Animate a thinking spinner while a task is being executed. Animate a thinking spinner while a task is being executed.
It use a daemon thread to run the animation. This will not block the main thread. It use a daemon thread to run the animation. This will not block the main thread.
@ -77,9 +77,10 @@ def animate_thinking(text, color="status", duration=2):
} }
fore_color, term_color = color_map.get(color, color_map["default"]) fore_color, term_color = color_map.get(color, color_map["default"])
spinner = itertools.cycle([ spinner = itertools.cycle([
'█▒▒▒▒▒', '██▒▒▒▒', '███▒▒▒', '████▒▒', '█████▒', '██████', '▉▁▁▁▁▁', '▉▉▂▁▁▁', '▉▉▉▃▁▁', '▉▉▉▉▅▁', '▉▉▉▉▉▇', '▉▉▉▉▉▉',
'█████▒', '████▒▒', '███▒▒▒', '██▒▒▒▒', '█▒▒▒▒▒', '▒█▒▒▒█', '▉▉▉▉▇▅', '▉▉▉▆▃▁', '▉▉▅▃▁▁', '▉▇▃▁▁▁', '▇▃▁▁▁▁', '▃▁▁▁▁▁',
'▒▒█▒█▒', '▒▒▒██▒', '▒█▒█▒▒', '█▒▒▒▒▒' '▁▃▅▃▁▁', '▁▅▉▅▁▁', '▃▉▉▉▃▁', '▅▉▁▉▅▃', '▇▃▁▃▇▅', '▉▁▁▁▉▇',
'▉▅▃▁▃▅', '▇▉▅▃▅▇', '▅▉▇▅▇▉', '▃▇▉▇▉▅', '▁▅▇▉▇▃', '▁▃▅▇▅▁'
]) ])
end_time = time.time() + duration end_time = time.time() + duration