jackwener/OpenCLI · error · CommandExecutionError

IMDb blocked this request

Error message

IMDb blocked this request

What it means

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.

Source

Thrown at clis/imdb/trending.js:24

 */
cli({
    site: 'imdb',
    name: 'trending',
    access: 'read',
    description: 'IMDb Most Popular Movies',
    domain: 'www.imdb.com',
    strategy: Strategy.PUBLIC,
    browser: true,
    args: [
        { name: 'limit', type: 'int', default: 20, help: 'Number of results' },
    ],
    columns: ['rank', 'title', 'rating', 'genre', 'url'],
    func: async (page, args) => {
        const url = forceEnglishUrl('https://www.imdb.com/chart/moviemeter/');
        await page.goto(url);
        await page.wait(2);
        if (await isChallengePage(page)) {
            throw new CommandExecutionError('IMDb blocked this request', 'Try again with a normal browser session or extension mode');
        }
        // Extract the ItemList JSON-LD block which contains all chart entries
        const ld = await extractJsonLd(page, 'ItemList');
        if (!ld || !Array.isArray(ld.itemListElement)) {
            throw new CommandExecutionError('Could not find chart data on page', 'IMDb may have changed their page structure');
        }
        const limit = Math.max(1, Math.min(Number(args.limit) || 20, 100));
        const items = ld.itemListElement.slice(0, limit);
        return items.map((entry, index) => {
            const item = entry.item || {};
            const rating = item.aggregateRating || {};
            const genre = Array.isArray(item.genre)
                ? item.genre.join(', ')
                : String(item.genre || '');
            // Normalize relative URLs to absolute IMDb URLs
            let itemUrl = item.url || '';
            if (itemUrl && !/^https?:\/\//.test(itemUrl)) {
                itemUrl = 'https://www.imdb.com' + itemUrl;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a normal browser session or extension mode.
  2. Slow down polling cadence and cache trending results (they change at most daily).
  3. Switch to a residential/different IP if blocks continue.
  4. Refresh cookies or sign in to IMDb in the automated browser profile.

Example fix

// before
await imdbTrending({ limit: 50 }); // blocked from CI runner
// after
await imdbTrending({ limit: 50, mode: 'extension' }); // reuse real logged-in browser session
Defensive patterns

Strategy: retry

Try / catch

try {
  return await imdbTrending({ limit: 50 });
} catch (e) {
  if (/IMDb blocked this request/.test(e.message)) {
    await sleep(60_000);
    return retryWithBackoff(() => imdbTrending({ limit: 50, mode: 'extension' }), { attempts: 3 });
  }
  throw e;
}

Prevention

When it happens

Trigger: page.goto of https://www.imdb.com/chart/moviemeter/, page.wait(2), then isChallengePage(page) returns true — a bot challenge replaced the moviemeter chart.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/9926f5874f3272c7. Report an issue: GitHub.