{"record":{"id":"8defa3944814ab7f","repo":"jackwener/OpenCLI","slug":"the-note-page-loaded-without-visible-content-the","errorCode":null,"errorMessage":"The note page loaded without visible content. The note may be deleted or restricted.","messagePattern":"The note page loaded without visible content\\. The note may be deleted or restricted\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xiaohongshu/note.js","lineNumber":104,"sourceCode":"        if (data.securityBlock) {\n            throw new CliError('SECURITY_BLOCK', 'Xiaohongshu security block: the note detail page was blocked by risk control.', /^https?:\\/\\//.test(raw)\n                ? 'The page may be temporarily restricted. Try again later or from a different session.'\n                : 'Try using a full URL from search results (with xsec_token) instead of a bare note ID.');\n        }\n        if (data.loginWall) {\n            throw new AuthRequiredError('www.xiaohongshu.com', 'Note content requires login');\n        }\n        if (data.notFound) {\n            throw new EmptyResultError('xiaohongshu/note', `Note ${noteId} not found or unavailable — it may have been deleted or restricted`);\n        }\n        const d = data;\n        // XHS renders placeholder text like \"赞\"/\"收藏\"/\"评论\" when count is 0;\n        // normalize to '0' unless the value looks numeric.\n        const numOrZero = (v) => /^\\d+/.test(v) ? v : '0';\n        // A note may legitimately have no title, but a real note page always\n        // renders an author. If both are missing, the page failed to load.\n        if (!d.title && !d.author) {\n            throw new EmptyResultError('xiaohongshu/note', 'The note page loaded without visible content. The note may be deleted or restricted.');\n        }\n        const rows = [\n            { field: 'title', value: d.title || '' },\n            { field: 'author', value: d.author || '' },\n            { field: 'content', value: d.desc || '' },\n            { field: 'likes', value: numOrZero(d.likes || '') },\n            { field: 'collects', value: numOrZero(d.collects || '') },\n            { field: 'comments', value: numOrZero(d.comments || '') },\n        ];\n        if (d.tags?.length) {\n            rows.push({ field: 'tags', value: d.tags.join(', ') });\n        }\n        return rows;\n    },\n});\n","sourceCodeStart":86,"sourceCodeEnd":120,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/note.js#L86-L120","documentation":"EmptyResultError thrown by the xiaohongshu note CLI when the scraped note page has neither a title nor an author. Since every real XHS note page renders an author, both being empty means the page never actually loaded its content (deleted note, restricted/hidden note, login wall, or anti-bot interstitial). The library throws to prevent emitting a misleading empty result.","triggerScenarios":"Calling the note command with a URL/id of a deleted or privacy-restricted note; XHS serving a login wall or verification page; the page rendering an error state instead of note content so d.title and d.author are both empty after extraction.","commonSituations":"Sharing links that were later deleted; notes limited to followers or removed by moderation; scraping without a logged-in cookie so XHS redirects to a login/verify page; IP flagged by XHS risk control returning a blank shell page.","solutions":["Verify the note URL opens and shows content in a normal browser (ideally logged in).","Provide valid login cookies/session for the xiaohongshu CLI session.","Retry later or from a different IP if XHS risk control is serving a blank page.","Treat the note as unavailable and handle the EmptyResultError in your workflow."],"exampleFix":"// before\nconst note = await xhs.note('https://xhslink.com/abc'); // throws if note deleted\n// after\ntry {\n  const note = await xhs.note(url);\n} catch (err) {\n  if (err.name === 'EmptyResultError') skipNote(url); // note deleted/restricted\n}","handlingStrategy":"try-catch","validationCode":"// pre-check URL reachability/content in your own scraper if possible;\n// otherwise nothing to validate client-side beyond the URL format\nif (!/^https?:\\/\\/(www\\.)?xiaohongshu\\.com\\//.test(url)) throw new Error('bad note url');","typeGuard":"function looksLikeValidNoteData(d) {\n  return typeof d === 'object' && d !== null &&\n    (typeof d.title === 'string' && d.title.length > 0 ||\n     typeof d.author === 'string' && d.author.length > 0);\n}","tryCatchPattern":"try {\n  const note = await xhs.note(url);\n} catch (err) {\n  if (err.name === 'EmptyResultError') {\n    markNoteUnavailable(url); // deleted/restricted\n  } else throw err;\n}","preventionTips":["Use fresh, valid login cookies for the session","Check the note URL manually in a browser before bulk scraping","Handle EmptyResultError as 'note unavailable', not a bug","Rotate IPs / reduce request rate to avoid XHS risk-control blank pages"],"tags":["scraping","empty-result","xiaohongshu"],"backgroundTag":"empty-scrape-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}