jackwener/OpenCLI · error · AuthRequiredError
dianping.com
Error message
dianping.com
What it means
detectAuthOrPageFailure inspects the rendered page text and final URL of a dianping request. When the signal matches captcha indicators (verify.meituan.com, verifyimg, 身份核实, 请依次点击, 美团安全验证, Yoda) it throws AuthRequiredError('dianping.com', ...) telling you the request was blocked by Meituan's Yoda icon-tap captcha. Dianping short-circuits HTML to this captcha when its bot checks trip, so no real data was rendered.
Source
Thrown at clis/dianping/utils.js:107
return Promise.resolve()
.then(fn)
.catch((err) => {
if (err?.code) throw err;
const message = err?.message || String(err);
throw new CommandExecutionError(`dianping ${label} failed: ${message}`);
});
}
/**
* Throw the right typed error for a dianping page that didn't render data.
* The site short-circuits HTML when bot/login checks trip — typically
* redirects to verify.meituan.com (Yoda icon-tap captcha) or to a login
* page when the cookie is missing.
*/
export function detectAuthOrPageFailure({ text = '', url = '' }, contextHint, { emptyPatterns = [] } = {}) {
const signal = `${url} ${text}`;
if (/verify\.meituan\.com|verifyimg|身份核实|请依次点击|美团安全验证|Yoda/i.test(signal)) {
throw new AuthRequiredError(
'dianping.com',
`dianping ${contextHint} blocked by captcha — open ${url || 'www.dianping.com'} manually in this profile and solve the captcha, then retry`,
);
}
if (/login\.dianping\.com|account\.dianping\.com|请先登录|未登录|请登录/.test(signal)) {
throw new AuthRequiredError(
'dianping.com',
`dianping ${contextHint} requires login — sign in to dianping.com in this profile, then retry`,
);
}
if (emptyPatterns.some((pattern) => pattern.test(signal))) {
throw new EmptyResultError(`dianping ${contextHint}`);
}
const sample = text ? `; sample: ${String(text).slice(0, 160)}` : '';
throw new CommandExecutionError(
`dianping ${contextHint} did not render expected data${sample}`,
'This usually means dianping changed its HTML, returned an unexpected error page, or the browser profile hit an unrecognized anti-bot state.',
);View on GitHub (pinned to 49907e53dc)
Solutions
- Open the reported URL (or www.dianping.com) manually in the same browser profile and solve the captcha, then retry the command.
- Slow down: add delays between requests and reduce request volume per profile.
- Refresh/replace the dianping login cookies with a freshly authenticated session.
- Run non-headless (or with a more realistic fingerprint) and avoid datacenter IPs; if it recurs, wait before retrying to let the rate-limit cool down.
Defensive patterns
Strategy: retry
Validate before calling
// quick session probe before scraping
const res = await page.goto('https://www.dianping.com');
const signal = `${page.url()} ${await page.content()}`;
if (/verify\.meituan\.com|verifyimg|身份核实|请依次点击|美团安全验证|Yoda/i.test(signal)) {
throw new Error('captcha pending — solve it in the browser profile first');
} Type guard
function isAuthRequiredError(err) {
return err instanceof Error && err.code === 'AUTH_REQUIRED' && /captcha/i.test(err.message || '');
} Try / catch
try {
await dianpingSearch(args);
} catch (err) {
if (err.code === 'AUTH_REQUIRED' && /captcha/i.test(err.message)) {
console.error('Solve the captcha in the browser profile, then rerun.');
process.exitCode = 2;
} else throw err;
} Prevention
- Throttle request rate and add randomized delays between dianping calls.
- Use a logged-in, human-used browser profile rather than a fresh headless one.
- Avoid datacenter IPs; run from a residential connection when possible.
- Pause scraping after any captcha until it is solved — repeated attempts deepen the flag.
When it happens
Trigger: Any dianping step that calls detectAuthOrPageFailure while the page URL/text contains a meituan verification redirect — typically after several automated requests from one cookie profile, an aged/flagged cookie, or a headless fingerprint that trips anti-bot checks.
Common situations: Scraping many search pages back-to-back from the same profile, running headless with default browser flags, reusing a cookie jar that dianping has flagged, or a datacenter IP making the session suspicious.
Related errors
- flights.ctrip.com
- hotels.ctrip.com
- 请先在共享 Chrome 完成 1688 登录/验证,再重试(${action})
- auth
- Ctrip is asking for a captcha; complete it in your browser s
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/42d03944c29d589c.
Report an issue: GitHub.