Skip to content

Rebuild on kit: status, comments, suggest alongside hot - #1

Merged
tamnd merged 2 commits into
mainfrom
kit-rebuild
Jun 15, 2026
Merged

Rebuild on kit: status, comments, suggest alongside hot#1
tamnd merged 2 commits into
mainfrom
kit-rebuild

Conversation

@tamnd

@tamnd tamnd commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Migrates from bare cobra/fang to the any-cli/kit framework so all four read ops are exposed as CLI, HTTP (weibo serve), and MCP (weibo mcp) from one registration
  • Three new surfaces — all public, no cookies required:
    • weibo status <id> — fetch one post by numeric id or URL
    • weibo comments <id> — top comments under a post (up to 20 per page, paginated via max_id)
    • weibo suggest <query> — search autocomplete from the Weibo search sidebar
  • weibo hot is rewritten on the same kit model; existing behaviour is unchanged
  • Status and comment text has HTML stripped (br→space, tag regex), Weibo timestamps normalised to UTC
  • Two hosts: weibo.com (desktop headers) for hot+suggest, m.weibo.cn (mobile headers + MWeibo-Pwa/X-Requested-With) for status+comments
  • Removes pkg/render (kit handles all output formats)
  • Adds github.com/tamnd/any-cli v0.4.0

Test plan

  • go test ./... green
  • weibo hot -n 5 returns 5 ranked rows
  • weibo status 5309997458393240 returns a post with stripped text and normalised date
  • weibo comments 5309997458393240 -n 3 returns 3 comments
  • weibo suggest 山姆 returns autocomplete rows
  • weibo serve binds on :8080 and responds at /v1/hot
  • weibo mcp starts up without error

tamnd added 2 commits June 15, 2026 12:41
Migrates from a bare cobra/fang setup to the any-cli/kit framework so all
four read ops (hot, status, comments, suggest) are exposed as CLI, HTTP
(serve), and MCP (mcp) from a single registration.

New public surfaces — all anonymous, no cookies:
- status <id>    fetch one post by numeric id or URL
- comments <id>  top comments under a post (up to 20 per page)
- suggest <q>    search autocomplete (hotquery from weibo.com sidebar)

hot is rewritten on the same kit model; the existing behaviour is unchanged.
Status text and comment text have HTML stripped (br→space, tag regex).
Weibo timestamps ("Mon Jun 15 09:05:12 +0800 2026") are normalised to UTC
"2026-06-15 01:05:12". Two hosts are used: weibo.com for desktop endpoints,
m.weibo.cn (mobile headers) for statuses/show and comments/hotflow.

Removes pkg/render (kit handles table/json/jsonl/csv/tsv/url rendering).
Adds github.com/tamnd/any-cli v0.4.0.
@tamnd
tamnd merged commit a6b5f79 into main Jun 15, 2026
7 checks passed
@tamnd
tamnd deleted the kit-rebuild branch June 15, 2026 05:46
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