feat: add article, hot, search, comments commands and 6 more channels - #1
Open
tamnd wants to merge 1 commit into
Open
feat: add article, hot, search, comments commands and 6 more channels#1tamnd wants to merge 1 commit into
tamnd wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
article,hot,search,commentsArticleBaseURL,CommentBaseURL,SearchBaseURLtoConfigso each endpoint is independently overridable in testsNew commands
netease163 article <docid|url>3g.163.com/touch/reconstruct/article/info/{docid}.jsonnetease163 hotnews.163.com/special/0001386F/news_hot.jsvar data=[...];JS wrappernetease163 search <query>so.163.com/search?keyword=...netease163 comments <docid|url>comment.api.163.com/api/v1/products/.../hotCommentsReferer: https://news.163.com/Test plan
go build ./...passesgo test ./...passes (23 httptest-only tests, 0 network calls)netease163 channelsshows 12 channelsnetease163 hotreturns articlesnetease163 article <docid>returns article detailnetease163 search <query>returns search resultsnetease163 comments <docid>returns comments