feat(dianping): browser adapter — search + shop on www.dianping.com#1309
Merged
feat(dianping): browser adapter — search + shop on www.dianping.com#1309
Conversation
82009c4 to
09a98ad
Compare
Adds two browser-mode adapters for the dianping (大众点评) PC site: - `dianping search "<keyword>" --city <name|id> --limit <n>`: keyword shop/restaurant search. Returns rank, shop_id, name, rating, reviews, price, cuisine, district, url. shop_id round-trips into `dianping shop`. - `dianping shop <shop_id>` (alias `detail`): shop detail sheet (field/value rows: name, rating, breakdown 口味/环境/服务/食材, reviews, price, rank, hours, address, subway, features, url). Both use Strategy.COOKIE on www.dianping.com (the PC site renders search SSR and does not require JS hydration). m.dianping.com is intentionally crippled for non-mobile UAs, so it's not used. Auth detection (utils.detectAuthOrEmpty) inspects both response text and final URL for the Meituan Yoda captcha redirect (verify.meituan.com) and the dianping login redirect; raises AuthRequiredError with the captcha URL embedded so the user can clear it manually in the same profile. Listing↔detail id pairing: search.shop_id → shop.<id>. Adds 'shop' to DETAIL_NAMES in scripts/check-listing-id-pairing.mjs so the convention gate scans this site (35 sites / 78 listings now covered).
83d03ef to
2ff6b3e
Compare
This was referenced May 4, 2026
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
Adds two new browser-mode adapters for 大众点评 (dianping) on
www.dianping.com:dianping search "<keyword>" --city <name|id> --limit <n>— keyword shop/restaurant search.Columns:
rank, shop_id, name, rating, reviews, price, cuisine, district, url.dianping shop <shop_id>(aliasdetail) — shop detail field/value sheet(name, rating, breakdown 口味/环境/服务/食材, reviews, price, rank, hours, address,
subway, features, url).
search.shop_idround-trips intoshop, so listing→detail pairing is satisfied.Why www.dianping.com (PC site)
m.dianping.comis intentionally crippled for non-mobile UAs — body renders as 2 charsto push users into the native app. The PC site renders search results SSR and does not
require JS hydration, so adapters target it directly with
Strategy.COOKIE.Auth handling
utils.detectAuthOrEmpty({text, url}, hint)inspects both response text and thefinal URL for:
verify.meituan.com→AuthRequiredError(message embeds the captcha URL so the user can click and clear it in the same profile)
login.dianping.com/account.dianping.com→AuthRequiredErrorEmptyResultErrorVerified live with
opencli dianping search 火锅 --city beijing --trace on:the request hit the Yoda captcha and the adapter raised
AUTH_REQUIRED: dianping search "火锅" blocked by captcha — open https://verify.meituan.com/...with the actual
requestCode. Trace artifact at~/.opencli/profiles/default/traces/20260504142805-4accf89f/.Listing↔detail ID pairing
Adds
'shop'toDETAIL_NAMESinscripts/check-listing-id-pairing.mjsso theconvention gate now covers this site. After the change:
Scanned 35 site(s) / 78 listings ✓ — every listing carries an id-shaped column.Files
clis/dianping/utils.js— CITY_ID map (20 cities),resolveCityId,detectAuthOrEmpty({text, url}, hint),parseReviewCount,parsePriceclis/dianping/search.js— keyword search, parses#shop-all-list liSSR DOMclis/dianping/shop.js— detail sheet, parses.shop-head+ breakdown + featuresdocs/adapters/browser/dianping.md— adapter docs (commands, examples, troubleshooting)docs/.vitepress/config.mts+docs/adapters/index.md— sidebar/index entriesscripts/check-listing-id-pairing.mjs—'shop'added to DETAIL_NAMEScli-manifest.json— rebuilt (662 → 664 entries)Test plan
pnpm build-manifest— 664 entriespnpm typecheck— cleannode scripts/check-listing-id-pairing.mjs --strict— 35/78 ✓pnpm docs:build— clean