{"record":{"id":"9926f5874f3272c7","repo":"jackwener/OpenCLI","slug":"imdb-blocked-this-request-9926f5","errorCode":null,"errorMessage":"IMDb blocked this request","messagePattern":"IMDb blocked this request","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/imdb/trending.js","lineNumber":24,"sourceCode":" */\ncli({\n    site: 'imdb',\n    name: 'trending',\n    access: 'read',\n    description: 'IMDb Most Popular 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', 'genre', 'url'],\n    func: async (page, args) => {\n        const url = forceEnglishUrl('https://www.imdb.com/chart/moviemeter/');\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, 100));\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/trending.js#L6-L42","documentation":"The imdb trending command throws CommandExecutionError('IMDb blocked this request') when, after navigating to https://www.imdb.com/chart/moviemeter/ and waiting 2 seconds, isChallengePage(page) detects an anti-bot challenge page. IMDb served a CAPTCHA/interstitial instead of the trending chart, so extraction never starts.","triggerScenarios":"page.goto of https://www.imdb.com/chart/moviemeter/, page.wait(2), then isChallengePage(page) returns true — a bot challenge replaced the moviemeter chart.","commonSituations":"Automated polling of the trending chart from datacenter IPs, headless-browser fingerprints, aggressive scraping cadence tripping rate limits, or flagged cookies in the controlled browser.","solutions":["Retry with a normal browser session or extension mode.","Slow down polling cadence and cache trending results (they change at most daily).","Switch to a residential/different IP if blocks continue.","Refresh cookies or sign in to IMDb in the automated browser profile."],"exampleFix":"// before\nawait imdbTrending({ limit: 50 }); // blocked from CI runner\n// after\nawait imdbTrending({ limit: 50, mode: 'extension' }); // reuse real logged-in browser session","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await imdbTrending({ limit: 50 });\n} catch (e) {\n  if (/IMDb blocked this request/.test(e.message)) {\n    await sleep(60_000);\n    return retryWithBackoff(() => imdbTrending({ limit: 50, mode: 'extension' }), { attempts: 3 });\n  }\n  throw e;\n}","preventionTips":["Cache trending results and refresh at most daily; avoid aggressive polling.","Prefer extension/real-browser session mode to pass anti-bot checks.","Scrape from residential IPs; CI/cloud egress IPs are commonly blocked.","Add randomized delays between chart requests to reduce rate-limit triggers."],"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"}