{"record":{"id":"69a85297999d4773","repo":"jackwener/OpenCLI","slug":"douyin-delete-aweme-id-must-be-a-numeric-id","errorCode":null,"errorMessage":"douyin delete aweme_id must be a numeric id","messagePattern":"douyin delete aweme_id must be a numeric id","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/douyin/delete.js","lineNumber":15,"sourceCode":"import { cli, Strategy } from '@jackwener/opencli/registry';\nimport { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';\nimport { browserFetch } from './_shared/browser-fetch.js';\nimport { requireObjectEvaluateResult } from './_shared/evaluate-result.js';\n\nconst CREATOR_MANAGE_URL = 'https://creator.douyin.com/creator-micro/content/manage';\nconst WORK_LIST_URL = '/janus/douyin/creator/pc/work_list?status=0&count=20&max_cursor=0&scene=star_atlas&device_platform=android&aid=1128';\n\nfunction readAwemeId(raw) {\n    const value = String(raw ?? '').trim();\n    if (!value) {\n        throw new ArgumentError('douyin delete aweme_id cannot be empty');\n    }\n    if (!/^\\d+$/.test(value)) {\n        throw new ArgumentError('douyin delete aweme_id must be a numeric id');\n    }\n    return value;\n}\n\nfunction sleep(ms) {\n    return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function deleteViaCreatorManage(page, workId) {\n    await page.goto(CREATOR_MANAGE_URL);\n    await sleep(3000);\n    await sleep(3000);\n    const result = requireObjectEvaluateResult(await page.evaluate(`\n    (async () => {\n      const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n      const targetId = ${JSON.stringify(String(workId))};\n      const textOf = (node) => (node && (node.innerText || node.textContent) || '').trim();\n      const normalize = (value) => String(value || '').replace(/\\\\s+/g, ' ').trim();","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/douyin/delete.js#L1-L33","documentation":"Thrown by readAwemeId when the aweme_id argument contains characters other than digits. Douyin aweme ids are long numeric strings, so the library rejects anything else early. Thrown as an ArgumentError for invalid user input.","triggerScenarios":"Passing a full share URL or 'https://v.douyin.com/xxx' instead of the numeric id; passing an id with stray quotes, commas, or trailing characters; using an item_id/short_id that is non-numeric.","commonSituations":"Pasting a share link copied from the Douyin app instead of the numeric work id; whitespace or hidden characters from copy-paste; mixing up short video ids with aweme ids.","solutions":["Extract the numeric id (from the work list or the share URL's aweme_id query param) and pass only digits","Trim surrounding quotes/whitespace from the argument","Validate locally with /^\\d+$/ before invoking the CLI"],"exampleFix":"// before\ncli delete 'https://v.douyin.com/iAbCdE/'\n// after\nconst id = new URL(link).searchParams.get('aweme_id'); // or extract digits\ncli delete(id);","handlingStrategy":"validation","validationCode":"const id = String(raw ?? '').trim();\nif (!/^\\d+$/.test(id)) throw new Error(`aweme_id must be numeric, got: ${raw}`);","typeGuard":"function isNumericId(raw) {\n  return /^\\d+$/.test(String(raw ?? '').trim());\n}","tryCatchPattern":"try {\n  await cli.delete(awemeId);\n} catch (e) {\n  if (/must be a numeric id/.test(e.message)) {\n    const digits = String(awemeId).match(/\\d{10,}/); // try extracting from pasted URL\n    if (digits) return cli.delete(digits[0]);\n  } throw e;\n}","preventionTips":["Strip share URLs down to the numeric aweme_id query param before calling","Trim quotes/whitespace when copying ids from logs","Validate with /^\\d+$/ before invoking"],"tags":["douyin","argument","validation","cli"],"backgroundTag":"invalid-argument-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}