Files
Agent-Reach/agent_reach/channels/reddit.py
T
Pnant 15f161e5b5 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>
2026-03-31 17:04:58 +08:00

32 lines
863 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""Reddit — search and read via rdt-cli (public-clis/rdt-cli)."""
import shutil
import subprocess
from .base import Channel
class RedditChannel(Channel):
name = "reddit"
description = "Reddit 帖子和评论"
backends = ["rdt-cli"]
tier = 0
def can_handle(self, url: str) -> bool:
from urllib.parse import urlparse
d = urlparse(url).netloc.lower()
return "reddit.com" in d or "redd.it" in d
def check(self, config=None):
rdt = shutil.which("rdt")
if rdt:
return "ok", (
"rdt-cli 可用(搜索帖子、阅读全文、查看评论,无需登录)"
)
return "off", (
"需要安装 rdt-cli\n"
" pipx install rdt-cli\n"
"或:\n"
" uv tool install rdt-cli"
)