{"record":{"id":"3d82f8928297de27","repo":"jackwener/OpenCLI","slug":"jike-topic-page-did-not-expose-the-expected-data-s","errorCode":null,"errorMessage":"Jike topic page did not expose the expected data script","messagePattern":"Jike topic page did not expose the expected data script","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/jike/topic.js","lineNumber":58,"sourceCode":"    return { ok: false, reason: 'parse-error', message: e?.message || String(e) };\n  }\n})()\n`);\n        if (Array.isArray(data)) {\n            if (data.length === 0) {\n                throw new EmptyResultError('jike topic', `No posts were returned for topic ${args.id}. Confirm the topic ID and login state.`);\n            }\n            return data.slice(0, limit).map((item) => ({\n                content: item.content ?? '',\n                author: item.author ?? '',\n                likes: item.likes ?? 0,\n                comments: item.comments ?? 0,\n                time: item.time ?? '',\n                url: `https://web.okjike.com/originalPost/${item.id ?? ''}`,\n            }));\n        }\n        if (data?.reason === 'missing-data-script') {\n            throw new CommandExecutionError('Jike topic page did not expose the expected data script');\n        }\n        if (data?.reason === 'parse-error') {\n            throw new CommandExecutionError(`Failed to parse Jike topic data: ${data.message || 'unknown error'}`);\n        }\n        throw new CommandExecutionError('Jike topic returned an unreadable payload');\n    },\n});\n","sourceCodeStart":40,"sourceCodeEnd":66,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/topic.js#L40-L66","documentation":"The topic CLI scrapes data from a <script type=\"application/json\"> tag injected by the m.okjike.com page. When no such script element exists in the DOM, the in-page evaluate returns {reason:'missing-data-script'} and the CLI throws CommandExecutionError. This means the page did not render in the expected Next.js/SSR shape.","triggerScenarios":"page.evaluate finds no script[type=\"application/json\"] — e.g. the page served a login wall, an error page, a bot-check/CAPTCHA, or Jike redesigned the page to use a different data mechanism.","commonSituations":"Expired cookies causing a redirect to a login page; Jike front-end upgrade replacing the JSON script tag; anti-bot interstitial; network issues serving a partial/HTML error page.","solutions":["Re-login to Jike to eliminate login-wall redirects, then retry.","Open https://m.okjike.com/topics/<id> in a browser and inspect whether script[type=\"application/json\"] still exists.","Retry later if a bot-check/CAPTCHA interstitial is being served.","Update the CLI/package if Jike changed the page structure permanently."],"exampleFix":"// before\nconst el = document.querySelector('script[type=\"application/json\"]');\nif (!el) return { ok: false, reason: 'missing-data-script' };\n// after: also try __NEXT_DATA__ by id\nconst el = document.querySelector('script#__NEXT_DATA__') || document.querySelector('script[type=\"application/json\"]');\nif (!el) return { ok: false, reason: 'missing-data-script' };","handlingStrategy":"retry","validationCode":"// confirm session is live and page renders before scraping\nawait page.goto(url, { waitUntil: 'domcontentloaded' });\nif (await page.$('script[type=\"application/json\"]') === null) await page.reload();","typeGuard":null,"tryCatchPattern":"try {\n  return await runCli(['jike', 'topic', id]);\n} catch (e) {\n  if (/did not expose the expected data script/.test(e.message) && attempt < 3) return retryAfterLogin();\n  throw e;\n}","preventionTips":["Keep Jike cookies fresh to avoid login-wall HTML without the data script.","Reload/Re-check the page when Jike deploys front-end changes.","Detect bot-check/CAPTCHA interstitials before evaluating scripts.","Pin/update the scraper when m.okjike.com markup changes."],"tags":["scraping","jike","dom"],"backgroundTag":"missing-page-data","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}