{"record":{"id":"2d45537d1303a0d2","repo":"jackwener/OpenCLI","slug":"youdao-note-parser-found-note-content-but-extracte","errorCode":null,"errorMessage":"Youdao note parser found note content but extracted no readable text","messagePattern":"Youdao note parser found note content but extracted no readable text","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/youdao/note.js","lineNumber":204,"sourceCode":"    throw new CommandExecutionError(`Youdao note parser failed: ${reason}`);\n  }\n  const title = String(data[1] ?? '');\n  const content = String(data[2] ?? '');\n  const summary = String(data[3] ?? '');\n  const keywords = String(data[4] ?? '');\n  const createTime = data[5];\n  const fileSize = data[6];\n  const hasContentField = data[7] === true;\n  const rawContentLength = Number(data[8] ?? 0);\n  const finalUrl = String(data[9] || sourceUrl);\n  if (!title) {\n    throw new CommandExecutionError('Youdao note parser did not extract a title');\n  }\n  if (!hasContentField) {\n    throw new CommandExecutionError('Youdao note parser did not find full note content in the page store');\n  }\n  if (rawContentLength > 0 && !content) {\n    throw new CommandExecutionError('Youdao note parser found note content but extracted no readable text');\n  }\n  const row = {};\n  row.title = title;\n  row.content = content;\n  row.summary = summary;\n  row.keywords = keywords;\n  row.created_at = formatYoudaoTimestamp(createTime);\n  row.file_size = fileSize == null ? '' : String(fileSize);\n  row.url = finalUrl;\n  return row;\n}\n\nvar command = cli({\n  site: 'youdao',\n  name: 'note',\n  access: 'read',\n  description: 'Read a public shared Youdao Note',\n  domain: 'share.note.youdao.com',","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/youdao/note.js#L186-L222","documentation":"When the page store reports a nonzero raw content length (data[8]) but the extractor produced no readable text in `content`, normalization throws. This catches the case where content exists but the HTML-to-text extraction silently yielded nothing.","triggerScenarios":"rawContentLength > 0 while the content-extraction step returned an empty string — e.g. content stored as markup the text extractor doesn't handle (all images/embeds), a regex/DOM walk that strips everything, or an encoding mismatch.","commonSituations":"Notes composed only of images or attachments; Youdao changing the editor markup so the text walker finds no text nodes; malformed/legacy note formats.","solutions":["Inspect the raw content in the page store and extend the text-extraction logic to handle its markup","Add a fallback that decodes/uses the raw content when readable text is empty","Open the note in a browser to confirm it actually has readable text","Update buildExtractorJs for current Youdao editor DOM structure"],"exampleFix":"// before\nif (!content) throw new CommandExecutionError('...no readable text');\n// after\nif (!content && rawContentLength > 0) content = stripHtmlTags(rawContent) || '(note contains no extractable text)';","handlingStrategy":"type-guard","validationCode":"if (Number(payload?.rawContentLength ?? 0) > 0 && (!payload || !payload.content || payload.content.trim() === '')) {\n  throw new Error('Content exists in store but text extraction produced nothing');\n}","typeGuard":"function hasReadableContent(p) {\n  return typeof p?.content === 'string' && p.content.trim().length > 0;\n}","tryCatchPattern":"try {\n  await cli.youdao.note({ url });\n} catch (e) {\n  if (/extracted no readable text/.test(e.message)) {\n    console.warn('Note likely contains only images/attachments; export manually if needed');\n  } else throw e;\n}","preventionTips":["Check the note actually contains text (not only images) before automating","Handle markup-based content in the text extractor","Add a raw-content fallback path","Test extractor against legacy note formats"],"tags":["parsing","extraction"],"backgroundTag":"extracted-field-missing","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}