diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f33764..bb0898d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: dest: ${{env.output_filename}}.zip - name: Upload zipped artifact ${{ matrix.os }} - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: ${{env.output_filename}} path: ${{env.output_filename}}.zip diff --git a/.github/workflows/build_release_draft.yml b/.github/workflows/build_release_draft.yml index d5b2996..985a273 100644 --- a/.github/workflows/build_release_draft.yml +++ b/.github/workflows/build_release_draft.yml @@ -59,7 +59,7 @@ jobs: dest: ${{env.output_filename}}.zip - name: Upload zipped artifact ${{ matrix.os }} - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: ${{env.output_filename}} path: ${{env.output_filename}}.zip diff --git a/README.md b/README.md index 67bdf90..451ace6 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Get exclusive Feature Previews as a [:gem: Supporter & Feature Tester](https://b - CPU load and bandwidth can get heavy. Channels with 160p work best. - Tested on Windows 10 with headless ~100, headful ~30. Linux and macOS is experimental. -The Crude Viewer Amplifier (CVAmp) is a small GUI tool that spawns muted Google Chrome instances via [Playwright](https://github.com/microsoft/playwright-python), each with a different user-agent and HTTP proxy connection. Each instance navigates to the streaming channel and selects the lowest possible resolution. +The Crude Viewer Amplifier (CVAmp) is a small GUI tool that spawns muted Google Chrome instances via [Playwright](https://github.com/microsoft/playwright-python), each with a different HTTP proxy connection. Each instance navigates to the streaming channel and selects the lowest possible resolution. Read the comprehensive [wiki](https://github.com/KevinBytesTheDust/cvamp/wiki) for a [detailed tutorial](https://github.com/KevinBytesTheDust/cvamp/wiki/Detailed-Tutorial), [usage tips](https://github.com/KevinBytesTheDust/cvamp/wiki/Advanced-features-and-controls) and [troubleshooting steps](https://github.com/KevinBytesTheDust/cvamp/wiki/Troubleshooting). diff --git a/cvamp/gui.py b/cvamp/gui.py index b2d9a27..0da7f28 100644 --- a/cvamp/gui.py +++ b/cvamp/gui.py @@ -205,6 +205,7 @@ def __init__(self, parent, manager, *args, **kwargs): self.manager = manager self.headless = tk.BooleanVar(value=manager.get_headless()) self.auto_restart = tk.BooleanVar(value=manager.get_auto_restart()) + self.block_video_checkbox_value = tk.BooleanVar(value=False) global system_default_color system_default_color = self.cget("bg") @@ -251,6 +252,16 @@ def __init__(self, parent, manager, *args, **kwargs): ) auto_restart_checkbox.place(x=255, y=94) + block_video_checkbox = ttk.Checkbutton( + self, + text="low cpu", + onvalue=True, + offvalue=False, + variable=self.block_video_checkbox_value, + state=tk.DISABLED, + ) + block_video_checkbox.place(x=344, y=94) + # right instances_text = tk.Label(self, text="Instances", borderwidth=2) instances_text.place(x=455, y=10) diff --git a/cvamp/instance.py b/cvamp/instance.py index cedeffd..b6cd6a0 100644 --- a/cvamp/instance.py +++ b/cvamp/instance.py @@ -124,26 +124,40 @@ def save_screenshot(self): self.page.screenshot(path=filename) def spawn_page(self, restart=False): - proxy_dict = self.proxy_dict + CHROMIUM_ARGS = [ + "--window-position={},{}".format(self.location_info["x"], self.location_info["y"]), + "--no-sandbox", + "--disable-setuid-sandbox", + "--no-first-run", + "--disable-blink-features=AutomationControlled", + "--mute-audio", + "--webrtc-ip-handling-policy=disable_non_proxied_udp", + "--force-webrtc-ip-handling-policy", + ] + + if self.headless: + CHROMIUM_ARGS.append("--headless=old") - self.status = utils.InstanceStatus.RESTARTING if restart else utils.InstanceStatus.STARTING + proxy_dict = self.proxy_dict if not proxy_dict: proxy_dict = None + self.status = utils.InstanceStatus.RESTARTING if restart else utils.InstanceStatus.STARTING + self.playwright = sync_playwright().start() self.browser = self.playwright.chromium.launch( proxy=proxy_dict, - headless=self.headless, channel="chrome", - args=[ - "--window-position={},{}".format(self.location_info["x"], self.location_info["y"]), - "--mute-audio", - ], + headless=False, + args=CHROMIUM_ARGS, ) + + major_version = self.browser.version.split(".")[0] self.context = self.browser.new_context( viewport={"width": 800, "height": 600}, + user_agent=f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{major_version}.0.0.0 Safari/537.36", proxy=proxy_dict, ) diff --git a/cvamp/sites.py b/cvamp/sites.py index 1e53bd4..65cdbec 100644 --- a/cvamp/sites.py +++ b/cvamp/sites.py @@ -100,10 +100,11 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def todo_every_loop(self): - self.page.keyboard.press("l") + if self.page.query_selector('div.html5-video-player:not(.playing-mode)'): + self.page.keyboard.press("Space") try: - self.page.click("button.ytp-skip-ad-button", timeout=100) + self.page.click("button.ytp-ad-skip-button-modern", timeout=100) except: pass diff --git a/poetry.lock b/poetry.lock index fb6ff37..710cbbf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -358,24 +358,24 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest- [[package]] name = "playwright" -version = "1.41.2" +version = "1.43.0" description = "A high-level API to automate web browsers" category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "playwright-1.41.2-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:cf68335a5dfa4038fa797a4ba0105faee0094ebbb372547d7a27feec5b23c672"}, - {file = "playwright-1.41.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:431e3a05f8c99147995e2b3e8475d07818745294fd99f1510b61756e73bdcf68"}, - {file = "playwright-1.41.2-py3-none-macosx_11_0_universal2.whl", hash = "sha256:0608717cbf291a625ba6f751061af0fc0cc9bdace217e69d87b1eb1383b03406"}, - {file = "playwright-1.41.2-py3-none-manylinux1_x86_64.whl", hash = "sha256:4bf214d812092cf5b9b9648ba84611aa35e28685519911342a7da3a3031f9ed6"}, - {file = "playwright-1.41.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eaa17ab44622c447de26ed8f7d99912719568d8dbc3a9db0e07f0ae1487709d9"}, - {file = "playwright-1.41.2-py3-none-win32.whl", hash = "sha256:edb210a015e70bb0d328bf1c9b65fa3a08361f33e4d7c4ddd1ad2adb6d9b4479"}, - {file = "playwright-1.41.2-py3-none-win_amd64.whl", hash = "sha256:71ead0f33e00f5a8533c037c647938b99f219436a1b27d4ba4de4e6bf0567278"}, + {file = "playwright-1.43.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:b03b12bd4da9c2cfb78dff820deac8b52892fe3c2f89a4d95d6f08c59e41deb9"}, + {file = "playwright-1.43.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e9ec21b141727392f630761c7f4dec46d80c98243614257cc501b64ff636d337"}, + {file = "playwright-1.43.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:e05a8d8fb2040c630429cca07e843c8fa33059717837c8f50c01b7d1fc651ce1"}, + {file = "playwright-1.43.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:50d9a5c07c76456945a2296d63f78fdf6eb11aed3e8d39bb5ccbda760a8d6d41"}, + {file = "playwright-1.43.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:87191272c40b4c282cf2c9449ca3acaf705f38ac6e2372270f1617ce16b661b8"}, + {file = "playwright-1.43.0-py3-none-win32.whl", hash = "sha256:bd8b818904b17e2914be23e7bc2a340b203f57fe81678520b10f908485b056ea"}, + {file = "playwright-1.43.0-py3-none-win_amd64.whl", hash = "sha256:9b7bd707eeeaebee47f656b2de90aa9bd85e9ca2c6af7a08efd73896299e4d50"}, ] [package.dependencies] greenlet = "3.0.3" -pyee = "11.0.1" +pyee = "11.1.0" [[package]] name = "pluggy" @@ -424,21 +424,21 @@ test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] [[package]] name = "pyee" -version = "11.0.1" +version = "11.1.0" description = "A rough port of Node.js's EventEmitter to Python with a few tricks of its own" category = "main" optional = false python-versions = ">=3.8" files = [ - {file = "pyee-11.0.1-py3-none-any.whl", hash = "sha256:9bcc9647822234f42c228d88de63d0f9ffa881e87a87f9d36ddf5211f6ac977d"}, - {file = "pyee-11.0.1.tar.gz", hash = "sha256:a642c51e3885a33ead087286e35212783a4e9b8d6514a10a5db4e57ac57b2b29"}, + {file = "pyee-11.1.0-py3-none-any.whl", hash = "sha256:5d346a7d0f861a4b2e6c47960295bd895f816725b27d656181947346be98d7c1"}, + {file = "pyee-11.1.0.tar.gz", hash = "sha256:b53af98f6990c810edd9b56b87791021a8f54fd13db4edd1142438d44ba2263f"}, ] [package.dependencies] typing-extensions = "*" [package.extras] -dev = ["black", "flake8", "flake8-black", "isort", "jupyter-console", "mkdocs", "mkdocs-include-markdown-plugin", "mkdocstrings[python]", "pytest", "pytest-asyncio", "pytest-trio", "toml", "tox", "trio", "trio", "trio-typing", "twine", "twisted", "validate-pyproject[all]"] +dev = ["black", "build", "flake8", "flake8-black", "isort", "jupyter-console", "mkdocs", "mkdocs-include-markdown-plugin", "mkdocstrings[python]", "pytest", "pytest-asyncio", "pytest-trio", "sphinx", "toml", "tox", "trio", "trio", "trio-typing", "twine", "twisted", "validate-pyproject[all]"] [[package]] name = "pyinstaller" @@ -724,4 +724,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11.0, <3.12" -content-hash = "304b71642fa86cd33049f51c04886138dfdf647ebb30a205ceb92b78466ad97b" +content-hash = "46c9f622256242c5744132fe1233d5d55b1f55b3e922283b404c982418211710" diff --git a/proxy/user-agents.txt b/proxy/user-agents.txt deleted file mode 100644 index f9948bd..0000000 --- a/proxy/user-agents.txt +++ /dev/null @@ -1 +0,0 @@ -Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ca62fc8..1d01f5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "cvamp" -version = "0.7.1" +version = "0.7.2" description = "Viewer Amplifier bot with playwright. Spawns low-resolution muted Chrome instances with proxy & user-agent. Requires HTTP proxies." authors = ["KevinBytesTheDust "] [tool.poetry.dependencies] python = "^3.11.0, <3.12" -playwright = "^1.22.0" +playwright = "1.43.0" psutil = "^5.9.0" toml = "^0.10.2" sv-ttk = "^0.1"