{"record":{"id":"7af3a6e5748ddc3a","repo":"DIYgod/RSSHub","slug":"no-post-replies-found-the-post-may-not-exist-or-t","errorCode":null,"errorMessage":"No post replies found. The post may not exist or the cookie is invalid.","messagePattern":"No post replies found\\. The post may not exist or the cookie is invalid\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/baidu/tieba/post.tsx","lineNumber":76,"sourceCode":"    ],\n    name: '帖子动态',\n    maintainers: ['u3u', 'FlanChanXwO'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const id = ctx.req.param('id');\n    const lz = ctx.req.path.includes('lz') ? 1 : 0;\n    const html = await getPost(id, lz);\n    const $ = load(html);\n\n    const title = $('.pb-title-wrap .pb-title').text().trim();\n\n    // 使用新的 Vue 渲染页面选择器 - 只选择 virtual-list-item 避免重复\n    const list = $('.virtual-list-item');\n\n    if (list.length === 0) {\n        throw new Error('No post replies found. The post may not exist or the cookie is invalid.');\n    }\n\n    return {\n        title: lz ? `【只看楼主】${title}` : title,\n        link: `https://tieba.baidu.com/p/${id}?see_lz=${lz}`,\n        description: `${title}的最新回复`,\n        item: list\n            .toArray()\n            .map((element) => {\n                const item = $(element);\n\n                // 作者名\n                const authorName = item.find('.head-name').text().trim();\n\n                // 跳过无效用户（无作者名的条目）\n                if (!authorName) {\n                    return null;\n                }","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/baidu/tieba/post.tsx#L58-L94","documentation":"The Tieba post route loads the post HTML, parses with cheerio, and selects '.virtual-list-item' (the Vue-rendered reply list). If that selector matches nothing it throws, indicating the post does not exist, is deleted, or the page was served without reply content (e.g. anti-bot page returned instead of the real HTML).","triggerScenarios":"getPost returns HTML that contains zero '.virtual-list-item' elements - typically because the post ID is invalid/deleted, or because the request was redirected to a login/captcha page that lacks the Vue reply list.","commonSituations":"Stale or invalid BAIDU_COOKIE causing the post page to render without replies; post ID typo; the post was removed by Baidu; Tieba changed the reply list CSS class from 'virtual-list-item' to something else.","solutions":["Refresh BAIDU_COOKIE and retry.","Open https://tieba.baidu.com/p/<id> in a browser (logged in) to confirm the post exists and renders replies.","If Baidu renamed the CSS class, update the selector at lib/routes/baidu/tieba/post.tsx:69."],"exampleFix":"// before\nconst list = $('.virtual-list-item');\n// after (selector renamed upstream)\nconst list = $('.reply-list-item');","handlingStrategy":"validation","validationCode":"function postHasReplies($: ReturnType<typeof load>): boolean {\n  return $('.virtual-list-item').length > 0;\n}\nif (!postHasReplies($)) throw new Error('Post has no replies or cookie invalid');","typeGuard":"const postLooksRendered = ($: ReturnType<typeof load>): boolean =>\n  $('.virtual-list-item').length > 0 || $('.pb-title-wrap .pb-title').length > 0;","tryCatchPattern":"try {\n  return await handler(ctx);\n} catch (e) {\n  if (e instanceof Error && /No post replies found/.test(e.message)) {\n    ctx.throw(404, 'Post not found or cookie invalid');\n  }\n  throw e;\n}","preventionTips":["Keep BAIDU_COOKIE fresh so the post page renders the Vue reply list.","Verify the post ID exists in a browser before relying on the route.","Add a test fixture of a real post HTML so a class rename is caught in CI."],"tags":["baidu-tieba","scraping","cookie","css-selector","rss-route"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}