{"record":{"id":"5ea33fe3bcf88ea1","repo":"jackwener/OpenCLI","slug":"xueqiu-comments-only-accepts-a-symbol-not-a-url","errorCode":null,"errorMessage":"xueqiu comments only accepts a symbol, not a URL","messagePattern":"xueqiu comments only accepts a symbol, not a URL","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/comments.js","lineNumber":349,"sourceCode":"            maxRequests: 5,\n            fetchPage: (pageNumber, currentPageSize) => fetchCommentsPage(page, symbol, pageNumber, currentPageSize),\n            warn: log.warn,\n        });\n        return rows.map(row => toCommentOutputRow(row));\n    },\n});\n/**\n * Convert raw CLI input into a normalized stock symbol.\n *\n * @param raw User-provided CLI argument.\n * @returns Upper-cased symbol string.\n */\nexport function normalizeSymbolInput(raw) {\n    const symbol = String(raw ?? '').trim().toUpperCase();\n    if (!symbol)\n        throw new ArgumentError('xueqiu comments requires a symbol');\n    if (/^HTTPS?:\\/\\//.test(symbol)) {\n        throw new ArgumentError('xueqiu comments only accepts a symbol, not a URL');\n    }\n    if (!XUEQIU_SYMBOL_PATTERN.test(symbol)) {\n        throw new ArgumentError(`xueqiu comments received an invalid symbol: ${symbol}`);\n    }\n    return symbol;\n}\n","sourceCodeStart":331,"sourceCodeEnd":356,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/comments.js#L331-L356","documentation":"normalizeSymbolInput rejects inputs that look like URLs (case-insensitively matching /^HTTPS?:\\/\\// after upper-casing). The command wants a bare ticker symbol, not a pasted xueqiu page URL, so users copying a link from the browser get this ArgumentError.","triggerScenarios":"Passing something like https://xueqiu.com/S/SH600519 or http://xueqiu.com/S/AAPL as the symbol argument.","commonSituations":"Copying the stock's xueqiu page URL from a browser address bar and pasting it directly as the argument, or automation that extracts links instead of symbols.","solutions":["Use the bare symbol instead of the URL, e.g. SH600519.","Extract the code from the URL if needed: the segment after /S/ (e.g. SH600519 from https://xueqiu.com/S/SH600519).","Strip or parse URLs in scripts before invoking the command."],"exampleFix":"// before\nclis/xueqiu comments https://xueqiu.com/S/SH600519\n// after\nclis/xueqiu comments SH600519","handlingStrategy":"validation","validationCode":"if (/^https?:\\/\\//i.test(rawSymbol)) {\n  rawSymbol = new URL(rawSymbol).pathname.split('/').pop(); // extract /S/<code>\n}","typeGuard":"const isUrl = (v) => typeof v === 'string' && /^https?:\\/\\//i.test(v.trim());","tryCatchPattern":null,"preventionTips":["Never paste full xueqiu URLs as the symbol.","Extract the code after /S/ when starting from a URL.","Sanitize inputs in automation pipelines."],"tags":["cli","argument-validation","xueqiu"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}