{"record":{"id":"69b16fab8a098d96","repo":"jackwener/OpenCLI","slug":"xueqiu-comments-supports-limit-up-to-100","errorCode":null,"errorMessage":"xueqiu comments supports --limit up to 100","messagePattern":"xueqiu comments supports --limit up to 100","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/xueqiu/comments.js","lineNumber":323,"sourceCode":"    navigateBefore: false,\n    args: [\n        {\n            name: 'symbol',\n            positional: true,\n            required: true,\n            help: 'Stock symbol, e.g. SH600519, AAPL, or 00700',\n        },\n        { name: 'limit', type: 'int', default: 20, help: 'Number of discussion posts to return' },\n    ],\n    columns: ['author', 'text', 'likes', 'replies', 'retweets', 'created_at', 'url'],\n    func: async (page, args) => {\n        const symbol = normalizeSymbolInput(args.symbol);\n        const limit = Number(args.limit);\n        if (!Number.isInteger(limit) || limit <= 0) {\n            throw new ArgumentError('xueqiu comments requires --limit to be a positive integer');\n        }\n        if (limit > 100) {\n            throw new ArgumentError('xueqiu comments supports --limit up to 100');\n        }\n        const pageSize = Math.min(limit, 20);\n        await page.goto('https://xueqiu.com');\n        const rows = await collectCommentRows({\n            symbol,\n            limit,\n            pageSize,\n            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.","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/comments.js#L305-L341","documentation":"The xueqiu comments command caps the number of fetched comments at 100. If --limit exceeds 100, an ArgumentError is thrown because the scraper's pagination strategy (pageSize 20, maxRequests 5) can collect at most 100 rows per run.","triggerScenarios":"Running the xueqiu comments command with --limit greater than 100, e.g. --limit 500 or --limit 1000.","commonSituations":"Users assuming unlimited scraping like other tools, trying to backfill a long discussion thread in one call, or scripts computing a large limit from a target row count.","solutions":["Reduce --limit to at most 100.","Paginate manually: run the command multiple times if you need more than 100 comments (the API only exposes limited pages anyway).","Clamp the value in scripts: --limit \"$(( LIMIT > 100 ? 100 : LIMIT ))\"."],"exampleFix":"// before\nclis/xueqiu comments AAPL --limit 500\n// after\nclis/xueqiu comments AAPL --limit 100","handlingStrategy":"validation","validationCode":"const limit = Number(rawLimit);\nif (Number.isInteger(limit) && limit > 100) {\n  limit = 100; // clamp instead of failing\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the hard cap: --limit max is 100.","Clamp user-supplied values to 100 in wrapper scripts.","Chain multiple invocations if more data is needed."],"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"}