From 5db83610702d602538fb873879dcd46ca0c24578 Mon Sep 17 00:00:00 2001 From: projectdx Date: Sat, 3 Jan 2026 22:04:59 +0900 Subject: [PATCH] fix: v0.5.12 - Switch to Google Chrome Stable to avoid Snap wrapper issues in Docker --- info.yaml | 2 +- mod_ohli24.py | 18 +++++++++---- zd_debug.py | 71 +++++++++++++++++++++++++++++---------------------- 3 files changed, 55 insertions(+), 36 deletions(-) diff --git a/info.yaml b/info.yaml index f951c8d..2514107 100644 --- a/info.yaml +++ b/info.yaml @@ -1,5 +1,5 @@ title: "애니 다운로더" -version: "0.5.11" +version: "0.5.12" package_name: "anime_downloader" developer: "projectdx" description: "anime downloader" diff --git a/mod_ohli24.py b/mod_ohli24.py index 3d18e9e..c4c77c7 100644 --- a/mod_ohli24.py +++ b/mod_ohli24.py @@ -241,7 +241,7 @@ class LogicOhli24(AnimeModuleBase): "os": platform.system(), "dist": "", "can_install": False, - "install_cmd": "apt-get update && apt-get install -y chromium-browser" + "install_cmd": "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google.list && apt-get update && apt-get install -y google-chrome-stable" } # 브라우저 찾기 @@ -250,7 +250,8 @@ class LogicOhli24(AnimeModuleBase): res["browser_found"] = True res["browser_path"] = manual_path else: - for cmd in ["google-chrome", "google-chrome-stable", "chromium-browser", "chromium"]: + # Snap 이슈를 피하기 위해 google-chrome을 우선순위로 둠 + for cmd in ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]: found = shutil.which(cmd) if found: res["browser_found"] = True @@ -279,12 +280,19 @@ class LogicOhli24(AnimeModuleBase): try: logger.info("[Zendriver] Starting system browser installation...") - # apt-get update + # Google Chrome Repo 등록 및 설치 (Snap 회피용) + sp.run(["apt-get", "update"], capture_output=True, text=True, timeout=300) + sp.run(["apt-get", "install", "-y", "wget", "gnupg"], capture_output=True, text=True, timeout=300) + + # Google Key & Repo + sp.run("wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -", shell=True, capture_output=True, text=True, timeout=60) + sp.run("echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google.list", shell=True, capture_output=True, text=True, timeout=60) + sp.run(["apt-get", "update"], capture_output=True, text=True, timeout=300) - # apt-get install + # Install Chrome process = sp.run( - ["apt-get", "install", "-y", "chromium-browser"], + ["apt-get", "install", "-y", "google-chrome-stable"], capture_output=True, text=True, timeout=600 diff --git a/zd_debug.py b/zd_debug.py index 6fecef5..72a83dc 100644 --- a/zd_debug.py +++ b/zd_debug.py @@ -3,48 +3,59 @@ import asyncio import zendriver as zd import sys import os -import inspect +import subprocess async def test(): - print("=== Zendriver API Inspection ===") + print("=== Zendriver Final Stand Debug ===") - # Inspect zd.start - print("\n--- zd.start Signature ---") + browser_bin = "/bin/chromium-browser" + if not os.path.exists(browser_bin): + browser_bin = "/usr/bin/chromium-browser" + + print(f"Testing browser binary: {browser_bin}") + + # 1. Try to run browser version check try: - sig = inspect.signature(zd.start) - print(sig) - for param in sig.parameters.values(): - print(f" {param.name}: {param.default}") + print("\n--- Checking Browser Version ---") + out = subprocess.check_output([browser_bin, "--version"], stderr=subprocess.STDOUT).decode() + print(f"Version output: {out}") except Exception as e: - print(f"Failed to inspect zd.start: {e}") + print(f"Version check failed: {e}") + if hasattr(e, 'output'): + print(f"Error output: {e.output.decode()}") - # Inspect zd.Config - print("\n--- zd.Config Attributes ---") + # 2. Try to run browser with minimum flags to see if it crashes + print("\n--- Direct Subprocess Start Test (Headless + No Sandbox) ---") try: - config = zd.Config() - # Filter out dunder methods - attrs = [a for a in dir(config) if not a.startswith("__")] - print(attrs) - - # Check current values - for a in attrs: - try: - val = getattr(config, a) - if not callable(val): - print(f" {a} = {val}") - except: - pass + # Just try to get help or something that starts the engine + cmd = [browser_bin, "--headless", "--no-sandbox", "--disable-gpu", "--remote-debugging-port=9222", "--about:blank"] + print(f"Running: {' '.join(cmd)}") + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + await asyncio.sleep(3) + if proc.poll() is None: + print(">>> SUCCESS: Browser process is ALIVE after 3 seconds!") + proc.terminate() + else: + stdout, stderr = proc.communicate() + print(f"FAIL: Browser process DIED instantly (code {proc.returncode})") + print(f"STDOUT: {stdout.decode()}") + print(f"STDERR: {stderr.decode()}") except Exception as e: - print(f"Failed to inspect zd.Config: {e}") + print(f"Process start test failed: {e}") - print("\n--- Testing Config 3: 'arguments' instead of 'browser_args' ---") + # 3. Last try with Zendriver and absolute bare settings + print("\n--- Zendriver Barebones Test ---") try: - # Based on typical Zendriver usage, it might be 'arguments' - browser = await zd.start(headless=True, no_sandbox=True, arguments=["--no-sandbox", "--disable-dev-shm-usage"]) - print("Success with Config 3 (arguments)!") + browser = await zd.start( + browser_executable_path=browser_bin, + headless=True, + sandbox=False, + browser_args=["--no-sandbox", "--disable-dev-shm-usage"] + ) + print(">>> SUCCESS: Zendriver connected!") await browser.stop() except Exception as e: - print(f"Config 3 (arguments) Failed: {e}") + print(f"Zendriver test failed: {e}") if __name__ == "__main__": asyncio.run(test())