fix(reddit,bilibili): switch to rdt-cli and add bili-cli support (#235)

Reddit: Exa crawling had chronic CRAWL_LIVECRAWL_TIMEOUT issues.
rdt-cli (304 stars, public-clis) works without login — search, read
full posts, and comments all verified. Massive improvement.

Bilibili: add bili-cli (590 stars) as optional enhanced backend for
hot/rank/search/feed. yt-dlp remains for video metadata + subtitles.

Also fix UA string (was "agent-reach/1.0", now proper browser UA).

75 tests passing.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pnant
2026-03-31 17:04:58 +08:00
committed by GitHub
parent 794455cc9f
commit 15f161e5b5
6 changed files with 1696 additions and 78 deletions
+12 -23
View File
@@ -1,30 +1,15 @@
# -*- coding: utf-8 -*-
"""Reddit — search and read via Exa (no direct Reddit API needed)."""
"""Reddit — search and read via rdt-cli (public-clis/rdt-cli)."""
import shutil
import subprocess
from .base import Channel
def _exa_available() -> bool:
"""Return True if mcporter is installed and Exa MCP is configured."""
mcporter = shutil.which("mcporter")
if not mcporter:
return False
try:
r = subprocess.run(
[mcporter, "config", "list"], capture_output=True,
encoding="utf-8", errors="replace", timeout=5
)
return "exa" in r.stdout.lower()
except Exception:
return False
class RedditChannel(Channel):
name = "reddit"
description = "Reddit 帖子和评论(通过 Exa 搜索和阅读)"
backends = ["Exa via mcporter"]
description = "Reddit 帖子和评论"
backends = ["rdt-cli"]
tier = 0
def can_handle(self, url: str) -> bool:
@@ -33,10 +18,14 @@ class RedditChannel(Channel):
return "reddit.com" in d or "redd.it" in d
def check(self, config=None):
if _exa_available():
return "ok", "通过 Exa 搜索和阅读 Reddit 内容(免费,无需代理)"
rdt = shutil.which("rdt")
if rdt:
return "ok", (
"rdt-cli 可用(搜索帖子、阅读全文、查看评论,无需登录)"
)
return "off", (
"需要 mcporter + Exa MCP。安装:\n"
" npm install -g mcporter\n"
" mcporter config add exa https://mcp.exa.ai/mcp"
"需要安装 rdt-cli\n"
" pipx install rdt-cli\n"
"或:\n"
" uv tool install rdt-cli"
)