feat(smzdm): add hot/detail read commands and favorite/zhi write ops#2016
Open
yixin-1024 wants to merge 1 commit into
Open
feat(smzdm): add hot/detail read commands and favorite/zhi write ops#2016yixin-1024 wants to merge 1 commit into
yixin-1024 wants to merge 1 commit into
Conversation
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>
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
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 (identicalli.feed-row-widemarkup).detail <id|url>— deal detail: title, price, optionalgo.smzdm.combuy link, canonical URL. Accepts a bare deal id,/p/<id>/path, or fullwww.smzdm.com/post.smzdm.comURL.Writes (
Strategy.UI)favorite <id|url>— collect a deal via.fav.J_zhi_like_fav; idempotent (detects the already-favoritedactivestate).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_COLUMNSmoved toclis/smzdm/shared.js;search.jsreuses 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 intomall.Not included
No
checkincommand: 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— cleannpm test— 542 files / 5682 tests pass, 0 failurescli-manifest.jsonregenerated (additive; each command carries anexample)docs/adapters/browser/smzdm.md+docs/adapters/index.md(sidebar already lists SMZDM)-f json:hot,detail,favorite,zhiAdapters are authored in
.jsto match the post-#928 adapter layer (every sibling adapter is.js).