{"record":{"id":"444844a1b1ff96b7","repo":"jackwener/OpenCLI","slug":"imdb-blocked-this-request-444844","errorCode":null,"errorMessage":"IMDb blocked this request","messagePattern":"IMDb blocked this request","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/imdb/search.js","lineNumber":32,"sourceCode":"    browser: true,\n    args: [\n        { name: 'query', positional: true, required: true, help: 'Search query' },\n        { name: 'limit', type: 'int', default: 20, help: 'Number of results' },\n    ],\n    columns: ['rank', 'id', 'title', 'year', 'type', 'url'],\n    func: async (page, args) => {\n        const query = String(args.query || '').trim();\n        // Reject empty or whitespace-only queries early\n        if (!query) {\n            throw new ArgumentError('Search query cannot be empty');\n        }\n        const limit = Math.max(1, Math.min(Number(args.limit) || 20, 50));\n        const url = forceEnglishUrl(`https://www.imdb.com/find/?q=${encodeURIComponent(query)}&ref_=nv_sr_sm`);\n        await page.goto(url);\n        const onSearchPage = await waitForImdbPath(page, '^/find/?$');\n        const searchReady = await waitForImdbSearchReady(page, 15000);\n        if (await isChallengePage(page)) {\n            throw new CommandExecutionError('IMDb blocked this request', 'Try again with a normal browser session or extension mode');\n        }\n        if (!onSearchPage || !searchReady) {\n            throw new CommandExecutionError('IMDb search results did not finish loading', 'Retry the command; if it persists, the search page structure may have changed');\n        }\n        const results = await page.evaluate(`\n      (function() {\n        var results = [];\n\n        function pushResult(item) {\n          if (!item || !item.id || !item.title) {\n            return;\n          }\n          results.push(item);\n        }\n\n        var nextDataEl = document.getElementById('__NEXT_DATA__');\n        if (nextDataEl) {\n          try {","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/imdb/search.js#L14-L50","documentation":"The imdb search command throws CommandExecutionError('IMDb blocked this request') when, after navigating to the IMDb /find/ URL, the page is detected as a bot-challenge page via isChallengePage(page). IMDb serves CAPTCHA or anti-bot interstitials instead of search results. The hint suggests retrying with a normal browser session or extension mode.","triggerScenarios":"page.goto of the IMDb find URL followed by waitForImdbPath and waitForImdbSearchReady succeed navigation-wise, but isChallengePage(page) returns true because IMDb presented a challenge/captcha page.","commonSituations":"Running from datacenter IPs or CI, heavy scripted usage triggering rate limiting, headless browser fingerprint detection, or cookies/session flagged by IMDb anti-bot protection.","solutions":["Retry later or from a different network/residential IP.","Run with the extension-based / normal browser session mode so real cookies and fingerprint are used.","Reduce request frequency and add delays between commands to avoid rate limiting.","Clear browser state/cookies that may be flagged, or log in to IMDb in the controlled browser."],"exampleFix":"// before\nawait imdbSearch({ query: 'inception' }); // fired in tight loop, got blocked\n// after\nawait sleep(3000); // back off between requests\nawait imdbSearch({ query: 'inception', mode: 'extension' });","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await imdbSearch({ query });\n} catch (e) {\n  if (/IMDb blocked this request/.test(e.message)) {\n    await sleep(30_000);\n    return retryWithBackoff(() => imdbSearch({ query, mode: 'extension' }), { attempts: 3 });\n  }\n  throw e;\n}","preventionTips":["Use the extension/normal browser session mode so real cookies and fingerprints are sent.","Throttle and add jitter between requests; avoid tight loops over many queries.","Run from residential IPs rather than datacenter/CI networks.","Cache results to reduce repeat hits on IMDb."],"tags":["anti-bot","captcha","network","rate-limit"],"backgroundTag":"bot-detection-blocked","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}