jackwener/OpenCLI · error · AuthRequiredError

www.rednote.com

Error message

www.rednote.com

What it means

AuthRequiredError is thrown when the rednote search results page is served behind a login wall instead of public results. The library detects this in-page (WAIT_FOR_CONTENT_JS returns 'login_wall') and raises with host 'www.rednote.com' and guidance that authentication is required.

Source

Thrown at clis/rednote/search.js:91

    site: 'rednote',
    name: 'search',
    access: 'read',
    description: 'Search rednote notes',
    domain: 'www.rednote.com',
    strategy: Strategy.COOKIE,
    navigateBefore: false,
    args: [
        { name: 'query', required: true, positional: true, help: 'Search keyword' },
        { name: 'limit', type: 'int', default: 20, help: 'Number of results' },
    ],
    columns: ['rank', 'title', 'author', 'likes', 'published_at', 'url', 'author_url'],
    func: async (page, kwargs) => {
        const limit = parseLimit(kwargs.limit ?? 20);
        const keyword = encodeURIComponent(kwargs.query);
        await page.goto(`https://www.rednote.com/search_result?keyword=${keyword}&source=web_search_result_notes`);
        const waitResult = unwrapEvaluateResult(await page.evaluate(WAIT_FOR_CONTENT_JS));
        if (waitResult === 'login_wall') {
            throw new AuthRequiredError('www.rednote.com', 'Rednote search results are blocked behind a login wall');
        }
        // Scroll until enough rows are rendered or the lazy-load plateaus.
        // Same fix as xiaohongshu/search (#1471): the previous fixed
        // `autoScroll({ times: 2 })` capped extraction at ~13 notes regardless
        // of `--limit`.
        await page.evaluate(buildScrollUntilJs(limit));
        const data = requireSearchRows(await page.evaluate(buildSearchExtractJs('www.rednote.com')));
        return data
            .filter((item) => item.title)
            .slice(0, limit)
            .map((item, i) => ({
            rank: i + 1,
            ...item,
            published_at: noteIdToDate(item.url),
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log in to www.rednote.com in the automation browser profile so a session cookie exists
  2. Re-authenticate if the stored session expired, then rerun the command
  3. Use a residential/session-persistent browser context rather than a fresh incognito profile
  4. Retry later if rednote is aggressively gating your IP; consider a different network

Example fix

// before
await page.goto(searchUrl); // anonymous profile -> login wall
// after
if (!await hasSession(page)) await loginToRednote(page); // establish cookies first
await page.goto(searchUrl);
Defensive patterns

Strategy: try-catch

Validate before calling

const state = unwrapEvaluateResult(await page.evaluate(WAIT_FOR_CONTENT_JS)); if (state === 'login_wall') throw new Error('authenticate www.rednote.com before searching');

Type guard

const isLoginWall = (state) => state === 'login_wall';

Try / catch

try { return await rednoteSearch(query, limit); } catch (e) { if (e instanceof AuthRequiredError && e.host === 'www.rednote.com') { await loginToRednote(page); return rednoteSearch(query, limit); } throw e; }

Prevention

When it happens

Trigger: page.evaluate(WAIT_FOR_CONTENT_JS) resolving to 'login_wall' after navigating to https://www.rednote.com/search_result?keyword=...&source=web_search_result_notes — rednote demands a logged-in session before showing search results.

Common situations: Fresh browser profiles with no rednote cookies, expired sessions, running from datacenter IPs that rednote forces to log in, or anonymous/incognito automation contexts.

Related errors


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