Skip to content

feat: add article, hot, search, comments commands and 6 more channels - #1

Open
tamnd wants to merge 1 commit into
mainfrom
feat/pr2-commands
Open

feat: add article, hot, search, comments commands and 6 more channels#1
tamnd wants to merge 1 commit into
mainfrom
feat/pr2-commands

Conversation

@tamnd

@tamnd tamnd commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds four missing commands per spec 2307: article, hot, search, comments
  • Expands channel list from 6 to 12 (adds finance, auto, home, world, edu, game)
  • Adds ArticleBaseURL, CommentBaseURL, SearchBaseURL to Config so each endpoint is independently overridable in tests

New commands

Command Endpoint Notes
netease163 article <docid|url> 3g.163.com/touch/reconstruct/article/info/{docid}.json Accepts docid or full URL; strips HTML from body
netease163 hot news.163.com/special/0001386F/news_hot.js Parses var data=[...]; JS wrapper
netease163 search <query> so.163.com/search?keyword=... Parses HTML result list with regex
netease163 comments <docid|url> comment.api.163.com/api/v1/products/.../hotComments Sends Referer: https://news.163.com/

Test plan

  • go build ./... passes
  • go test ./... passes (23 httptest-only tests, 0 network calls)
  • netease163 channels shows 12 channels
  • netease163 hot returns articles
  • netease163 article <docid> returns article detail
  • netease163 search <query> returns search results
  • netease163 comments <docid> returns comments

Implements the four missing commands from spec 2307:

- article <docid|url>: full article content via the 3g.163.com JSON API;
  strips HTML from body field; accepts docid or canonical URL
- hot: today's trending articles via news.163.com/special/0001386F/news_hot.js
  (var data=... JS wrapper)
- search <query>: searches so.163.com and parses the HTML result list
- comments <docid|url>: hot comments via comment.api.163.com with Referer header

Expands channels from 6 to 12: adds finance (cm_money), auto (cm_auto),
home (cm_house), world (cm_guoji), edu (cm_edu), game (cm_game).

Adds ArticleBaseURL / CommentBaseURL / SearchBaseURL to Config so tests
can override each endpoint independently. 23 httptest-only tests, all green.
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.

1 participant