{"record":{"id":"4578213220f90016","repo":"jackwener/OpenCLI","slug":"youdao-note-only-accepts-shared-note-urls","errorCode":null,"errorMessage":"youdao note only accepts shared note URLs","messagePattern":"youdao note only accepts shared note URLs","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/youdao/note.js","lineNumber":40,"sourceCode":"  }\n  let parsed;\n  try {\n    parsed = new URL(value);\n  } catch {\n    throw new ArgumentError('Invalid Youdao Note URL', 'Example: https://share.note.youdao.com/ynoteshare/index.html?id=...&type=note');\n  }\n  if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {\n    throw new ArgumentError('Youdao Note URL must use http or https');\n  }\n  if (!ALLOWED_HOSTS.has(parsed.hostname)) {\n    throw new ArgumentError('Youdao Note URL must be under note.youdao.com or note.youdao.cn');\n  }\n  if (!parsed.searchParams.get('id')) {\n    throw new ArgumentError('Youdao Note URL must include an id query parameter');\n  }\n  const type = parsed.searchParams.get('type');\n  if (type && type !== 'note') {\n    throw new ArgumentError('youdao note only accepts shared note URLs', 'Shared notebooks are not implemented yet.');\n  }\n  return parsed.toString();\n}\n\nfunction formatYoudaoTimestamp(value) {\n  if (value == null || value === '') return '';\n  const numeric = Number(value);\n  if (!Number.isFinite(numeric) || numeric <= 0) return String(value);\n  const millis = numeric < 10_000_000_000 ? numeric * 1000 : numeric;\n  const date = new Date(millis);\n  if (Number.isNaN(date.getTime())) return String(value);\n  return date.toISOString();\n}\n\nfunction buildExtractorJs() {\n  const walkTextFn = `\n    function walkText(node, out) {\n      if (!node || typeof node !== 'object') return;","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/youdao/note.js#L22-L58","documentation":"ArgumentError thrown by normalizeShareUrl when the URL's 'type' query parameter is present but not 'note' (e.g. type=notebook). Only single shared notes are supported; shared notebooks/groups are not implemented, so the library refuses them explicitly.","triggerScenarios":"Sharing a Youdao notebook (collaborative folder) instead of an individual note, producing a URL like '...index.html?id=<id>&type=notebook'; hand-editing the type param to another value.","commonSituations":"Users sharing a whole notebook and pasting that link; migrating scripts that iterated over notebook links; Youdao UI changes causing users to grab the wrong share entry point.","solutions":["Open the notebook and share/export the individual note, then use that single-note share URL (type=note)","Remove or correct the type parameter if it was hand-edited (type=note is expected)","Export notebook contents manually and process notes one URL at a time"],"exampleFix":"// before\nawait youdaoNote('https://share.note.youdao.com/ynoteshare/index.html?id=abc&type=notebook');\n// after\nawait youdaoNote('https://share.note.youdao.com/ynoteshare/index.html?id=abc&type=note');","handlingStrategy":"validation","validationCode":"function isNoteType(u) {\n  const t = new URL(u).searchParams.get('type');\n  return t === null || t === 'note';\n}\nif (!isNoteType(inputUrl)) throw new Error('shared notebooks are unsupported; share an individual note');","typeGuard":"function isSingleNoteShareUrl(v) {\n  const t = new URL(v).searchParams.get('type');\n  return t === null || t === 'note';\n}","tryCatchPattern":"try {\n  await youdaoNote(url);\n} catch (e) {\n  if (String(e.message).includes('only accepts shared note URLs')) {\n    // switch from notebook share to individual note share (type=note)\n  } else throw e;\n}","preventionTips":["Check the type param equals 'note' before batch processing share links","Educate users that whole-notebook shares are not supported","When crawling notebooks, enumerate and share each note individually"],"tags":["argument-error","unsupported-feature","validation","shared-notebook"],"backgroundTag":"unsupported-resource-type","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}