Skip to content

feat(v2ex): add node, user, member, replies, nodes commands#282

Merged
jackwener merged 7 commits intojackwener:mainfrom
Astro-Han:worktree-v2ex-commands
Mar 23, 2026
Merged

feat(v2ex): add node, user, member, replies, nodes commands#282
jackwener merged 7 commits intojackwener:mainfrom
Astro-Han:worktree-v2ex-commands

Conversation

@Astro-Han
Copy link
Contributor

Description

Add 5 new public API commands to the V2EX adapter, utilizing previously unused V1 API endpoints. All commands are strategy: public + browser: false — no login or browser required.

Command API Endpoint Description
v2ex node <name> /api/topics/show.json?node_name= Browse topics by node
v2ex user <username> /api/topics/show.json?username= List topics by user
v2ex member <username> /api/members/show.json?username= User profile
v2ex replies <id> /api/replies/show.json?topic_id= Topic replies
v2ex nodes /api/nodes/all.json All nodes sorted by topic count

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter) — updated existing v2ex page
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter) — N/A, v2ex entry already exists

Screenshots / Output

$ opencli v2ex node python --limit 5

  v2ex/node
┌──────┬──────────────────────────────────────────────┬──────────────┬─────────┐
│ Rank │ Title                                        │ Author       │ Replies │
├──────┼──────────────────────────────────────────────┼──────────────┼─────────┤
│ 1    │ 创造了 uv 的 Astral 公司被 OpenAI 收购       │ GPLer        │ 7       │
│ 2    │ 慎用 PyCharm Remote Development 功能          │ Deteriorator │ 13      │
│ 3    │ Python 3.15 JIT 的最新进展                    │ zxccv1876    │ 10      │
│ ...  │                                              │              │         │
└──────┴──────────────────────────────────────────────┴──────────────┴─────────┘

$ opencli v2ex replies 1000 --limit 3

  v2ex/replies
┌───────┬──────────┬─────────────────────────────────────────────┐
│ Floor │ Author   │ Content                                     │
├───────┼──────────┼─────────────────────────────────────────────┤
│ 1     │ romoo    │ 右下角的图标该变成三个了。 ^^               │
│ 2     │ Livid    │ 欢迎各位尝试重新上传头像以使用这个新架构 :) │
│ 3     │ airwolf  │ OK,我去换头像!                            │
└───────┴──────────┴─────────────────────────────────────────────┘

$ opencli v2ex member Livid

  v2ex/member
┌──────────┬───────────────────────────┬─────────────────┬────────┬─────────┬──────────┐
│ Username │ Tagline                   │ Website         │ Github │ Twitter │ Location │
├──────────┼───────────────────────────┼─────────────────┼────────┼─────────┼──────────┤
│ Livid    │ Remember the bigger green │ sepia.sol.build │        │         │          │
└──────────┴───────────────────────────┴─────────────────┴────────┴─────────┴──────────┘

$ opencli v2ex nodes --limit 5

  v2ex/nodes
┌──────┬────────────┬──────────┬────────┬───────┐
│ Rank │ Name       │ Title    │ Topics │ Stars │
├──────┼────────────┼──────────┼────────┼───────┤
│ 1    │ qna        │ 问与答   │ 237740 │ 4476  │
│ 2    │ all4all    │ 二手交易 │ 143686 │ 8245  │
│ 3    │ programmer │ 程序员   │ 70190  │ 9596  │
│ 4    │ jobs       │ 酷工作   │ 60143  │ 6474  │
│ 5    │ share      │ 分享发现 │ 45765  │ 6260  │
└──────┴────────────┴──────────┴────────┴───────┘

@Astro-Han
Copy link
Contributor Author

Note: CI failures (build, unit-test shard 2, e2e-headed) are caused by a missing turndown dependency in src/clis/zhihu/download.test.ts and src/download/article-download.ts. This is a pre-existing issue on the main branch (same CI failures visible on the latest main commit). Not related to this PR's changes.

Add 5 new public API commands to the v2ex adapter:
- node: browse topics by node name
- user: list topics by username
- member: show user profile
- replies: list topic replies
- nodes: list all nodes sorted by topic count

All commands use strategy: public, browser: false.
…ke tests

- Replace isExpectedChineseSiteRestriction with if(code===0) soft guard
  (V2EX is globally accessible; YAML fetch doesn't throw FETCH_ERROR)
- Add value assertions: member username===Livid, limit effectiveness
- Add smoke tests for node, member, replies, nodes commands
@Astro-Han Astro-Han force-pushed the worktree-v2ex-commands branch from 51e44dd to 2bde569 Compare March 23, 2026 07:39
…e test

- Add url to node.yaml and user.yaml pipeline map steps and columns
  (V2EX API provides item.url; improves usability for follow-up lookups)
- Add v2ex user smoke test (other 4 new commands all had smoke tests; user was missing)
- Update E2E assertions to verify url field in node/user results
@jackwener jackwener merged commit a83027d into jackwener:main Mar 23, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants