{"record":{"id":"b872ab4ef4ed63bc","repo":"jackwener/OpenCLI","slug":"failed-to-parse-visible-weibo-favorites","errorCode":null,"errorMessage":"Failed to parse visible Weibo favorites","messagePattern":"Failed to parse visible Weibo favorites","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/favorites.js","lineNumber":160,"sourceCode":"\n          if (rawText.length > 20) out.push({ text: rawText, url: postUrl });\n          if (out.length >= ${limit}) break;\n        }\n        return out;\n      })()\n    `)), 'weibo favorites');\n\n    if (rawData.length === 0) {\n      throw new EmptyResultError('weibo favorites', 'No favorites were visible on the favorites page');\n    }\n\n    const items = rawData\n      .map(card => parseFavoriteCard(card, favUrl))\n      .filter(Boolean);\n\n    const uniqueItems = dedupeFavorites(items, favUrl);\n    if (uniqueItems.length === 0) {\n      throw new CommandExecutionError('Failed to parse visible Weibo favorites');\n    }\n    return uniqueItems.slice(0, limit);\n  },\n});\n\nexport const __test__ = {\n  parseFavoriteCard,\n  parsePositiveInt,\n  dedupeFavorites,\n};\n","sourceCodeStart":142,"sourceCodeEnd":171,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/favorites.js#L142-L171","documentation":"clis/weibo/favorites.js:160 throws CommandExecutionError('Failed to parse visible Weibo favorites') when raw cards were found but every one failed parseFavoriteCard/dedupeFavorites, leaving zero unique items. It signals the page had content the parser could not understand, as opposed to a genuinely empty page.","triggerScenarios":"rawData is non-empty but each card's text lacks the expected fields (author/time/content lines), so parseFavoriteCard returns falsy for all cards, or dedupeFavorites removes everything because favUrl matching fails.","commonSituations":"Weibo changing the favorites-page DOM/text layout after an update; cards being ads, headers, or tab elements rather than actual favorite entries; locale/time-format changes breaking the regex heuristics; running an outdated CLI against a redesigned page.","solutions":["Update the CLI to the latest version — this usually means the page markup changed","Open weibo.com/fav in Chrome and inspect the card text to confirm the layout the parser expects","Retry later; if Weibo was mid-deploy the old layout may return","File a bug with a sample card text if the latest version still fails to parse"],"exampleFix":"// before: hard failure on redesign\nconst favs = await cli.run('weibo favorites', { limit });\n// after: degrade gracefully\nlet favs = [];\ntry { favs = await cli.run('weibo favorites', { limit }); }\ncatch (e) { console.warn('favorites parse failed; possibly Weibo markup change:', e.message); }","handlingStrategy":"fallback","validationCode":null,"typeGuard":"function isParseFailure(e) { return e instanceof Error && e.message === 'Failed to parse visible Weibo favorites'; }","tryCatchPattern":"let favorites = [];\ntry {\n  favorites = await cli.run('weibo favorites', { limit });\n} catch (e) {\n  if (isParseFailure(e)) {\n    console.warn('Weibo favorites page could not be parsed — CLI may need updating; continuing with empty result.');\n  } else throw e;\n}","preventionTips":["Keep the CLI updated; this error usually means Weibo changed its markup","Monitor for sudden onset across runs — that indicates a layout change, not bad data","Include the error in monitoring with a 'possible upstream redesign' label","Retry once after a delay before escalating"],"tags":["weibo","parsing","scraping","markup-change"],"backgroundTag":"page-parsing-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}