fix: 修复 _install_mcporter 函数丢失 + browser-cookie3 硬依赖 + 自动装 birdx

关键修复:
1. _install_mcporter() 函数定义被上次编辑误删(NameError 崩溃)
   → 恢复为独立函数
2. browser-cookie3 作为硬依赖在服务器上安装失败(缺 dbus/secretstorage)
   → 改为 optional[cookies]
3. birdx 不在自动安装流程中
   → _install_system_deps 增加自动 pip install birdx

install 流程现在完整覆盖:
  gh CLI → Node.js → birdx → mcporter → Exa → XHS → cookies → test
This commit is contained in:
Panniantong
2026-02-24 15:25:38 +01:00
parent 51f73639e2
commit d52520a17e
2 changed files with 19 additions and 2 deletions
+19
View File
@@ -283,7 +283,26 @@ def _install_system_deps():
except Exception:
print(" ⚠️ Node.js install failed. Install manually: https://nodejs.org")
# ── birdx (for Twitter search) ──
if shutil.which("birdx"):
print(" ✅ birdx already installed")
else:
if shutil.which("pip3") or shutil.which("pip"):
pip_cmd = "pip3" if shutil.which("pip3") else "pip"
try:
subprocess.run(
[pip_cmd, "install", "-q", "birdx"],
capture_output=True, text=True, timeout=120,
)
if shutil.which("birdx"):
print(" ✅ birdx installed (Twitter search + timeline)")
else:
print(" ⬜ birdx install failed (optional — Twitter reading still works via Jina)")
except Exception:
print(" ⬜ birdx install failed (optional — Twitter reading still works via Jina)")
def _install_mcporter():
"""Install mcporter and configure Exa + XiaoHongShu MCP servers."""
import shutil
import subprocess
-2
View File
@@ -27,13 +27,11 @@ dependencies = [
"pyyaml>=6.0",
"rich>=13.0",
"yt-dlp>=2024.0",
"browser-cookie3>=0.19",
]
[project.optional-dependencies]
browser = ["playwright>=1.40"]
cookies = ["browser-cookie3>=0.19"]
mcp = ["mcp[cli]>=1.0"]
all = ["playwright>=1.40", "mcp[cli]>=1.0", "browser-cookie3>=0.19"]
[project.scripts]