* feat(channels): add V2EX support via public API V2EX provides a public JSON API that requires no authentication. This PR adds: - agent_reach/channels/v2ex.py: V2EXChannel (tier=0, zero-config) - can_handle() matches v2ex.com URLs - check() verifies API reachability via urllib (no extra deps) - Register V2EXChannel in channels/__init__.py - SKILL.md: add V2EX section with curl examples for hot topics, node browsing, topic detail, replies, and user info - tests/test_channels.py: URL matching + mocked ok/warn check tests V2EX API endpoints used: GET /api/v2/topics/hot — hot topics GET /api/topics/show.json — node topics / topic detail GET /api/replies/show.json — topic replies GET /api/members/show.json — user info * feat(channels): expand V2EX channel with data-fetching methods Add get_hot_topics, get_node_topics, get_topic, get_user, and search methods to V2EXChannel using stdlib urllib only (no new dependencies). Update unit tests and SKILL.md with Python call examples. * feat(v2ex): add data fetching methods to V2EXChannel
64 lines
1.4 KiB
Python
64 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Channel registry — lists all supported platforms for doctor checks.
|
|
"""
|
|
|
|
from typing import List, Optional
|
|
from .base import Channel
|
|
|
|
# Import all channels
|
|
from .web import WebChannel
|
|
from .github import GitHubChannel
|
|
from .twitter import TwitterChannel
|
|
from .youtube import YouTubeChannel
|
|
from .reddit import RedditChannel
|
|
from .rss import RSSChannel
|
|
from .bilibili import BilibiliChannel
|
|
from .exa_search import ExaSearchChannel
|
|
from .xiaohongshu import XiaoHongShuChannel
|
|
from .douyin import DouyinChannel
|
|
from .linkedin import LinkedInChannel
|
|
from .wechat import WeChatChannel
|
|
from .weibo import WeiboChannel
|
|
from .xiaoyuzhou import XiaoyuzhouChannel
|
|
from .v2ex import V2EXChannel
|
|
|
|
|
|
|
|
ALL_CHANNELS: List[Channel] = [
|
|
GitHubChannel(),
|
|
TwitterChannel(),
|
|
YouTubeChannel(),
|
|
RedditChannel(),
|
|
BilibiliChannel(),
|
|
XiaoHongShuChannel(),
|
|
DouyinChannel(),
|
|
LinkedInChannel(),
|
|
WeChatChannel(),
|
|
WeiboChannel(),
|
|
XiaoyuzhouChannel(),
|
|
V2EXChannel(),
|
|
RSSChannel(),
|
|
ExaSearchChannel(),
|
|
WebChannel(),
|
|
]
|
|
|
|
|
|
def get_channel(name: str) -> Optional[Channel]:
|
|
"""Get a channel by name."""
|
|
for ch in ALL_CHANNELS:
|
|
if ch.name == name:
|
|
return ch
|
|
return None
|
|
|
|
|
|
def get_all_channels() -> List[Channel]:
|
|
"""Get all registered channels."""
|
|
return ALL_CHANNELS
|
|
|
|
|
|
__all__ = [
|
|
"Channel",
|
|
"ALL_CHANNELS",
|
|
"get_channel", "get_all_channels",
|
|
]
|