知乎提取器:从 Playwright 迁移到 DrissionPage 方案

- 使用 DrissionPage 替代 Playwright
- 实现 Cookie 管理和反爬绕过
- 支持回答/文章/问题三种内容类型
- 灵活配置(文件/环境变量/配置文件)
- 更新文档和配置文件
This commit is contained in:
OpenClaw Agent
2026-02-08 05:56:27 +08:00
parent aa206a1679
commit a69225ff2b
8 changed files with 665 additions and 79 deletions
+31
View File
@@ -296,6 +296,37 @@ class Config:
"""Get bilibili extraction timeout in seconds."""
return self.get('sources.bilibili.extraction.timeout', 30)
# Zhihu DrissionPage configuration
@property
def zhihu_enabled(self) -> bool:
"""知乎是否启用"""
return self.get('sources.zhihu.enabled', False)
@property
def zhihu_use_drissionpage(self) -> bool:
"""知乎是否使用 DrissionPage"""
return self.get('sources.zhihu.use_drissionpage', True)
@property
def zhihu_cookie_file(self) -> Optional[str]:
"""知乎 Cookie 文件路径"""
return self.get('sources.zhihu.cookie_file')
@property
def zhihu_cookie_str(self) -> Optional[str]:
"""知乎 Cookie 字符串"""
return self.get('sources.zhihu.cookie_str')
@property
def zhihu_timeout(self) -> int:
"""知乎提取超时时间(秒)"""
return self.get('sources.zhihu.timeout', 30)
@property
def zhihu_headless(self) -> bool:
"""知乎是否使用无头浏览器"""
return self.get('sources.zhihu.headless', True)
def ensure_dirs(self) -> None:
"""Ensure required directories exist."""
self.vault_path.mkdir(parents=True, exist_ok=True)