{"record":{"id":"b44e633ac70b7c86","repo":"jackwener/OpenCLI","slug":"imdb-blocked-this-request-b44e63","errorCode":null,"errorMessage":"IMDb blocked this request","messagePattern":"IMDb blocked this request","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/imdb/top.js","lineNumber":24,"sourceCode":" */\ncli({\n    site: 'imdb',\n    name: 'top',\n    access: 'read',\n    description: 'IMDb Top 250 Movies',\n    domain: 'www.imdb.com',\n    strategy: Strategy.PUBLIC,\n    browser: true,\n    args: [\n        { name: 'limit', type: 'int', default: 20, help: 'Number of results' },\n    ],\n    columns: ['rank', 'title', 'rating', 'votes', 'genre', 'url'],\n    func: async (page, args) => {\n        const url = forceEnglishUrl('https://www.imdb.com/chart/top/');\n        await page.goto(url);\n        await page.wait(2);\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        // Extract the ItemList JSON-LD block which contains all chart entries\n        const ld = await extractJsonLd(page, 'ItemList');\n        if (!ld || !Array.isArray(ld.itemListElement)) {\n            throw new CommandExecutionError('Could not find chart data on page', 'IMDb may have changed their page structure');\n        }\n        const limit = Math.max(1, Math.min(Number(args.limit) || 20, 250));\n        const items = ld.itemListElement.slice(0, limit);\n        return items.map((entry, index) => {\n            const item = entry.item || {};\n            const rating = item.aggregateRating || {};\n            const genre = Array.isArray(item.genre)\n                ? item.genre.join(', ')\n                : String(item.genre || '');\n            // Normalize relative URLs to absolute IMDb URLs\n            let itemUrl = item.url || '';\n            if (itemUrl && !/^https?:\\/\\//.test(itemUrl)) {\n                itemUrl = 'https://www.imdb.com' + itemUrl;","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/imdb/top.js#L6-L42","documentation":"The imdb top command throws CommandExecutionError('IMDb blocked this request') when, after navigating to https://www.imdb.com/chart/top/ and waiting 2 seconds, isChallengePage(page) detects an anti-bot challenge page. IMDb served a CAPTCHA/interstitial instead of the chart, so the command aborts before extracting the ItemList JSON-LD.","triggerScenarios":"page.goto of https://www.imdb.com/chart/top/, page.wait(2), then isChallengePage(page) returns true — the chart page was replaced by a bot challenge.","commonSituations":"Frequent polling of the Top 250 chart from a server IP, headless-browser detection, flagged cookies, or running inside CI/cloud where IMDb's anti-bot is aggressive.","solutions":["Retry with a normal browser session or extension mode.","Add longer waits/backoff between chart fetches; chart data changes rarely so cache results.","Use a different/residential IP if blocks persist.","Clear or refresh cookies/login state in the automated browser."],"exampleFix":"// before\nsetInterval(() => imdbTop({ limit: 250 }), 60_000); // every minute\n// after\nsetInterval(() => imdbTop({ limit: 250, mode: 'extension' }), 3_600_000); // hourly + real session","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await imdbTop({ limit: 250 });\n} catch (e) {\n  if (/IMDb blocked this request/.test(e.message)) {\n    await sleep(60_000);\n    return retryWithBackoff(() => imdbTop({ limit: 250, mode: 'extension' }), { attempts: 3 });\n  }\n  throw e;\n}","preventionTips":["Poll the Top 250 infrequently (hourly/daily) and cache — it changes rarely.","Use extension/normal browser mode with real cookies for chart scraping.","Avoid shared datacenter IPs that IMDb flags proactively.","Add backoff and jitter to all scheduled chart jobs."],"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-29T12:17:43.993Z"}