跳转到主要内容
按你的场景选择路径:新 URL 先用 detect 生成任务文件,已有任务使用 run <taskId>。采集完成后统一通过 data export 导出数据。
开始前请已完成 安装登录

路径一:让 Agent 生成并试采任务

LLM 或 Agent 创建任务时,推荐使用可信的本地 Agent 运行器,并立即采集少量样品验证质量:
octopus detect https://movie.douban.com/explore --agent --agent-command "node make-plan.mjs" --goal "提取电影名称、评分、导演和年份" --task-id douban-movies --output task.json --yes --run-sample 3 --json
--agent-command 是本地 shell 命令,不是自然语言提示。--run-sample 只支持 --agent 且必须为正整数。命令返回单个 JSON envelope;任务生成结果与样品采集结果应分别检查,尤其是 sampleRun.exitCodesampleRun.summary

路径二:直接操作 CLI 生成并运行任务

如果没有现成任务,先检测网页并生成任务文件:
octopus detect https://movie.douban.com/explore --auto --goal "提取电影名称和评分" --task-id douban-movies --output task.json
octopus task validate douban-movies --task-file task.json
octopus run douban-movies --task-file task.json --max-rows 20
--auto 适合用户直接操作 CLI。detect 会分析列表页、详情页与分页逻辑,但不会直接执行采集。常用检测方式:
octopus detect URL --auto --goal "提取商品名称、价格和链接" --task-id <taskId> --output task.json
octopus detect URL --manual --goal "提取商品详情" --task-id <taskId> --output task.json
octopus detect URL --auto --llm-rank --task-id <taskId> --output task.json
octopus detect URL --auto --json --task-id <taskId> --output task.json
需要手动选择候选区域时,先查看候选结果,再生成任务:
octopus detect URL
octopus detect URL --select protected_smart_1 --output task.json

路径三:运行已有任务

先列出任务:
octopus task list
octopus task list --keyword 新闻 --page 1 --page-size 10
octopus task list --json
从结果中记下 任务 IDtaskId)。 查看与校验任务:
octopus task inspect <taskId>
octopus task validate <taskId>
本地运行:
octopus run <taskId>
octopus run <taskId> --headless
octopus run <taskId> --max-rows 100
octopus run <taskId> --detach
octopus run <taskId> --output ./runs
后台运行后可查看、暂停、恢复或停止:
octopus local status <taskId>
octopus local pause <taskId>
octopus local resume <taskId>
octopus local stop <taskId>
octopus local cleanup
云端运行:
octopus cloud start <taskId>
octopus cloud status <taskId>
octopus cloud history <taskId>
octopus cloud stop <taskId>

导出数据

查看历史:
octopus data history <taskId>
octopus data history <taskId> --local
octopus data history <taskId> --cloud
导出结果:
octopus data export <taskId> --format xlsx --file result.xlsx
octopus data export <taskId> --local --format csv --file result.csv
octopus data export <taskId> --lot-id <lotId> --format json
支持格式:xlsxcsvhtmljsonxml

下一步

网页检测与任务生成

查看 octopus detect 的模式、参数与迁移说明。

运行采集任务

本地或云端运行已有任务和任务文件。