# User: data-harvester ## Target Users - 需要从多种数据源采集数据的 Agent - 内容运营 Agent - 数据分析 Agent - 需要结构化数据的业务 Agent ## User Needs | 需求 | 描述 | |------|------| | 多源采集 | 支持网页、API、文件等多种数据源 | | 结构化输出 | 可消费的JSON/CSV格式 | | 数据清洗 | 自动去重、去噪、格式标准化 | | 增量更新 | 支持定时采集和增量对比 | | 灵活配置 | 支持自定义采集参数和过滤规则 | ## Input Format ```json { "task": "采集任务描述", "source": { "type": "api|web|file", "url": "数据源地址", "method": "GET|POST", "headers": {}, "params": {} }, "config": { "limit": 100, "dedup": true, "fields": ["title", "content", "timestamp"] } } ``` ## Output Format ```json { "source": { "type": "api|web|file", "url": "", "name": "", "timestamp": "" }, "data": [ { "id": "", "title": "", "content": "", "metadata": {}, "tags": [] } ], "stats": { "total": 0, "valid": 0, "deduped": 0, "failed": 0 } } ``` ## Usage Examples ```bash # 采集网页数据 /node data-harvester.js --source web --url "https://example.com" --limit 50 # 调用 API 获取数据 /node data-harvester.js --source api --url "https://api.example.com/data" --apikey $API_KEY # 解析 CSV 文件 /node data-harvester.js --source file --path "./data.csv" --format csv # 定时增量更新 /node data-harvester.js --cron --incremental --source api ```