jackwener/OpenCLI · error · ArgumentError
youdao note only accepts shared note URLs
Error message
youdao note only accepts shared note URLs
What it means
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.
Source
Thrown at clis/youdao/note.js:40
}
let parsed;
try {
parsed = new URL(value);
} catch {
throw new ArgumentError('Invalid Youdao Note URL', 'Example: https://share.note.youdao.com/ynoteshare/index.html?id=...&type=note');
}
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
throw new ArgumentError('Youdao Note URL must use http or https');
}
if (!ALLOWED_HOSTS.has(parsed.hostname)) {
throw new ArgumentError('Youdao Note URL must be under note.youdao.com or note.youdao.cn');
}
if (!parsed.searchParams.get('id')) {
throw new ArgumentError('Youdao Note URL must include an id query parameter');
}
const type = parsed.searchParams.get('type');
if (type && type !== 'note') {
throw new ArgumentError('youdao note only accepts shared note URLs', 'Shared notebooks are not implemented yet.');
}
return parsed.toString();
}
function formatYoudaoTimestamp(value) {
if (value == null || value === '') return '';
const numeric = Number(value);
if (!Number.isFinite(numeric) || numeric <= 0) return String(value);
const millis = numeric < 10_000_000_000 ? numeric * 1000 : numeric;
const date = new Date(millis);
if (Number.isNaN(date.getTime())) return String(value);
return date.toISOString();
}
function buildExtractorJs() {
const walkTextFn = `
function walkText(node, out) {
if (!node || typeof node !== 'object') return;View on GitHub (pinned to 49907e53dc)
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
Example fix
// before
await youdaoNote('https://share.note.youdao.com/ynoteshare/index.html?id=abc&type=notebook');
// after
await youdaoNote('https://share.note.youdao.com/ynoteshare/index.html?id=abc&type=note'); Defensive patterns
Strategy: validation
Validate before calling
function isNoteType(u) {
const t = new URL(u).searchParams.get('type');
return t === null || t === 'note';
}
if (!isNoteType(inputUrl)) throw new Error('shared notebooks are unsupported; share an individual note'); Type guard
function isSingleNoteShareUrl(v) {
const t = new URL(v).searchParams.get('type');
return t === null || t === 'note';
} Try / catch
try {
await youdaoNote(url);
} catch (e) {
if (String(e.message).includes('only accepts shared note URLs')) {
// switch from notebook share to individual note share (type=note)
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- archive search sort must be one of ${SORT_OPTIONS.join(', ')
- archive search mediatype must be one of ${MEDIATYPES.join(',
- archive search limit must be a positive integer
- archive search limit must be <= 100
- archive search query must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4578213220f90016.
Report an issue: GitHub.