diff --git a/requirements.txt b/requirements.txt index f497250..fffb45f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,7 @@ aiohttp>2.0,<4.0 Pillow pystray -selenium-wire -# use a fork that has an extra option of hiding the unneeded Chrome's console cmd window -git+https://github.com/sebdelsol/undetected-chromedriver +# selenium-wire +# undetected-chromedriver # this is installed only on windows pywin32; sys_platform == "win32" diff --git a/setup_env.bat b/setup_env.bat index 6b9c1b2..812232f 100644 --- a/setup_env.bat +++ b/setup_env.bat @@ -12,6 +12,7 @@ if not exist "%dirpath%\env" ( ) echo: echo Installing requirements.txt... +"%dirpath%\env\scripts\python" install -U pip "%dirpath%\env\scripts\pip" install wheel "%dirpath%\env\scripts\pip" install -r "%dirpath%\requirements.txt" goto DONE diff --git a/twitch.py b/twitch.py index 86fd34a..0594dad 100644 --- a/twitch.py +++ b/twitch.py @@ -23,11 +23,17 @@ try: from seleniumwire.request import Request from selenium.common.exceptions import WebDriverException from seleniumwire.undetected_chromedriver import Chrome, ChromeOptions +except ModuleNotFoundError: + # the dependencies weren't installed, but they're not used either, so skip them + pass except ImportError as exc: - raise ImportError( - "You need to install Visual C++ Redist (x86 and x64): " - "https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads" - ) from exc + if "_brotli" in exc.msg: + raise ImportError( + "You need to install Visual C++ Redist (x86 and x64): " + "https://support.microsoft.com/en-gb/help/2977003/" + "the-latest-supported-visual-c-downloads" + ) from exc + raise from translate import _ from gui import GUIManager @@ -162,8 +168,6 @@ class _AuthState: options.add_argument("--disable-web-security") options.add_argument("--allow-running-insecure-content") options.add_argument("--lang=en") - options.add_argument("--no-sandbox") - options.add_argument("--test-type") options.add_argument("--disable-gpu") options.set_capability("pageLoadStrategy", "eager") try: @@ -174,6 +178,7 @@ class _AuthState: None, lambda: Chrome( options=options, + no_sandbox=True, suppress_welcome=True, version_main=version_main, seleniumwire_options=wire_options,