Skip to content

feat(smzdm): add hot/detail read commands and favorite/zhi write ops#2016

Open
yixin-1024 wants to merge 1 commit into
jackwener:mainfrom
yixin-1024:feat/smzdm-commands
Open

feat(smzdm): add hot/detail read commands and favorite/zhi write ops#2016
yixin-1024 wants to merge 1 commit into
jackwener:mainfrom
yixin-1024:feat/smzdm-commands

Conversation

@yixin-1024

Copy link
Copy Markdown
Contributor

Summary

Extends the 什么值得买 (smzdm) browser adapter beyond search, with all selectors verified live against the logged-in site and full unit coverage.

Reads

  • hot — curated home deals feed (/jingxuan/). Reuses the search feed extractor (identical li.feed-row-wide markup).
  • detail <id|url> — deal detail: title, price, optional go.smzdm.com buy link, canonical URL. Accepts a bare deal id, /p/<id>/ path, or full www.smzdm.com / post.smzdm.com URL.

Writes (Strategy.UI)

  • favorite <id|url> — collect a deal via .fav.J_zhi_like_fav; idempotent (detects the already-favorited active state).
  • zhi <id|url> [--down] — rate a deal 值 (default) / 不值. Confirms via the up-count bump. smzdm exposes no reliable on-load rated state, so an unconfirmed re-vote is reported honestly rather than as a false success.

Refactor

Shared feed extractor + limit/URL validation + FEED_COLUMNS moved to clis/smzdm/shared.js; search.js reuses them (behavior unchanged). The mall selector now also handles the home-feed shape where the mall is an <a> link rather than a nested <span>, so the update-time no longer leaks into mall.

Not included

No checkin command: the smzdm web sign-in endpoint (zhiyou.smzdm.com/user/checkin/jsonp_checkin) is captcha-gated (error_code 110202) and cannot be automated headlessly.

Validation (per CONTRIBUTING)

  • npx tsc --noEmit — clean
  • npm test542 files / 5682 tests pass, 0 failures
  • cli-manifest.json regenerated (additive; each command carries an example)
  • Adapter docs updated: docs/adapters/browser/smzdm.md + docs/adapters/index.md (sidebar already lists SMZDM)
  • End-to-end verified via the CLI incl. -f json: hot, detail, favorite, zhi

Adapters are authored in .js to match the post-#928 adapter layer (every sibling adapter is .js).

Extend the 什么值得买 (smzdm) adapter beyond search, with selectors
verified live against the logged-in site and full unit coverage.

Reads:
- `hot`    curated home deals feed (/jingxuan/) — reuses the search feed
           extractor (identical li.feed-row-wide markup).
- `detail` deal detail by id or URL — title, price, optional go.smzdm.com
           buy link, canonical url.

Writes (Strategy.UI):
- `favorite` collect a deal via .fav.J_zhi_like_fav; idempotent (detects the
             already-favorited `active` state).
- `zhi`      rate a deal 值 (default) / 不值 (--down). Confirms via the up-count
             bump; smzdm exposes no reliable on-load rated state, so an
             unconfirmed re-vote is reported honestly rather than as success.

Refactor: shared feed extractor, limit/url validation, and FEED_COLUMNS moved
to clis/smzdm/shared.js; search.js reuses them. The shared extractor's mall
selector now handles the home-feed shape where the mall is an <a> link (not a
nested <span>), so the update-time no longer leaks into `mall`. Existing search
behavior and tests are unchanged.

Each command carries an `example`; adapter docs updated (docs/adapters/browser/
smzdm.md + index.md).

Note: a `checkin` command was deliberately omitted — the smzdm web sign-in
endpoint (zhiyou.smzdm.com/user/checkin/jsonp_checkin) is captcha-gated
(error_code 110202) and cannot be automated headlessly.

Validation: tsc --noEmit clean; npm test green (542 files / 5682 tests);
hot/detail/favorite/zhi verified end-to-end via the CLI (incl. -f json).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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