|
|
@@ -321,6 +321,9 @@ class WeixinPublisher(BasePublisher):
|
|
|
from playwright.async_api import async_playwright
|
|
|
|
|
|
playwright = await async_playwright().start()
|
|
|
+ proxy = self.proxy_config if isinstance(getattr(self, 'proxy_config', None), dict) else None
|
|
|
+ if proxy and proxy.get('server'):
|
|
|
+ print(f"[{self.platform_name}] 使用代理: {proxy.get('server')}", flush=True)
|
|
|
|
|
|
# 参考 matrix: 使用系统内的 Chrome 浏览器,避免 H264 编码错误
|
|
|
# 如果没有安装 Chrome,则使用默认 Chromium
|
|
|
@@ -328,12 +331,16 @@ class WeixinPublisher(BasePublisher):
|
|
|
self.browser = await playwright.chromium.launch(
|
|
|
# headless=self.headless,
|
|
|
headless=False,
|
|
|
- channel="chrome" # 使用系统 Chrome
|
|
|
+ channel="chrome", # 使用系统 Chrome
|
|
|
+ proxy=proxy if proxy and proxy.get('server') else None
|
|
|
)
|
|
|
print(f"[{self.platform_name}] 使用系统 Chrome 浏览器")
|
|
|
except Exception as e:
|
|
|
print(f"[{self.platform_name}] Chrome 不可用,使用 Chromium: {e}")
|
|
|
- self.browser = await playwright.chromium.launch(headless=self.headless)
|
|
|
+ self.browser = await playwright.chromium.launch(
|
|
|
+ headless=self.headless,
|
|
|
+ proxy=proxy if proxy and proxy.get('server') else None
|
|
|
+ )
|
|
|
|
|
|
# 设置 HTTP Headers 防止重定向
|
|
|
headers = {
|