Fix: Catch all Playwright errors for curl fallback

ImportError only catches import failures. Browser launch errors
(executable not found) are runtime exceptions. Changed to catch
all Exception types to properly fallback to curl.
This commit is contained in:
saidsurucu
2025-12-04 14:44:39 +03:00
parent 5cec0df785
commit 91ad04cf09
+2 -2
View File
@@ -393,8 +393,8 @@ class KikV2ApiClient:
logger.info(f"KikV2ApiClient: Retrieved content via Playwright, length: {len(html_content)}") logger.info(f"KikV2ApiClient: Retrieved content via Playwright, length: {len(html_content)}")
except ImportError: except Exception as playwright_error:
logger.info("KikV2ApiClient: Playwright not available, falling back to curl") logger.info(f"KikV2ApiClient: Playwright failed ({type(playwright_error).__name__}: {str(playwright_error)[:100]}), falling back to curl")
# Fallback to curl (bypasses Python SSL issues with legacy servers) # Fallback to curl (bypasses Python SSL issues with legacy servers)
curl_path = shutil.which('curl') curl_path = shutil.which('curl')
if not curl_path: if not curl_path: