Documentation Index
Fetch the complete documentation index at: https://docs.olostep.com/llms.txt
Use this file to discover all available pages before exploring further.
NPM 包: olostep-cli
适用于 Olostep API 的 CLI:map、answer、scrape、scrape-get、crawl、batch-scrape 和 batch-update。响应为 JSON(美化格式),适用于脚本、CI 和代理。
安装此包会为你的操作系统下载一个独立的二进制文件。你不需要 Python 来运行 olostep。
在安装时,一个 postinstall 步骤会从包的 GitHub releases 下载匹配的二进制文件。如果失败,请确认此包版本和你的平台有对应的发布版本,然后重新安装。
要求: Node.js 16+(仅用于 npm / npx; CLI 本身是一个本地二进制文件)。
npm install -g olostep-cli
无需全局安装即可运行:
npx -y olostep-cli@latest --help
平台: macOS(Apple Silicon 和 Intel)、Linux x64、Windows x64。
API 密钥
在你的环境中设置 OLOSTEP_API_KEY,或在运行 olostep 的目录中的 .env 文件中设置。
创建密钥:Olostep API Keys。
export OLOSTEP_API_KEY=your_key_here
olostep --help
| 标志 | 行为 |
|---|
--out <path> | 将 JSON 写入文件(如果需要,将创建父目录)。 |
--out - | 仅将 JSON 写入 stdout(UTF-8,缩进)。适用于管道和子进程捕获。 |
进度和日志行会输出到 stderr,因此 stdout 保持可解析。
olostep map "https://example.com" --top-n 20 --out - | jq '.urls[:10]'
olostep scrape "https://example.com" --out - | jq .result.markdown_content
如果省略 --out,文件将放在 output/ 下(参见 默认 --out 路径)。
使用 olostep <command> --help 查看每个选项。大多数命令接受 --timeout(HTTP,秒)。
map: 发现 URL
| 选项 | 描述 |
|---|
--out | 文件路径或 - |
--top-n | 最大 URL 数量 |
--search-query | 引导发现 |
--include-subdomain / --no-include-subdomain | 子域名 |
--include-url / --exclude-url | 可重复的模式 |
--cursor | 分页 |
使用 --top-n,而不是 --limit(已移除)。
olostep map "https://example.com" --top-n 100 --search-query "blog"
answer: 研究答案
轮询直到答案准备好。
| 选项 | 描述 |
|---|
--out | 文件或 - |
--json-format | 可选的结构化输出提示(JSON 对象字符串) |
--poll-interval / --poll-timeout | 轮询(秒) |
使用 --json-format,而不是 --model(已移除)。
olostep answer "What does this company build?" --out answer.json
olostep answer "Extract facts" --json-format '{"company":"","year":""}' --out -
scrape: 单个 URL
格式: html、markdown、text、json、raw_pdf、screenshot(逗号分隔;默认 markdown)。
| 选项 | 描述 |
|---|
--formats | 逗号分隔 |
--country | 国家代码 |
--wait-before-scraping | 抓取前等待的毫秒数 |
--payload-json | 作为 JSON 对象字符串的高级选项 |
--payload-file | 同上,从文件中读取(不能与 --payload-json 一起使用) |
olostep scrape "https://example.com" --formats markdown,html
olostep scrape "https://example.com" --payload-file scrape-options.json --out -
scrape-get: 通过抓取 ID
olostep scrape-get "scrape_abc123" --out -
crawl: 网站爬取
检索格式: markdown、html、json。
显著标志:--max-pages、--max-depth、--include-subdomain、--include-external、--include-url、--exclude-url、--search-query、--top-n、--webhook、--crawl-timeout、--follow-robots-txt / --ignore-robots-txt、--formats、--pages-limit、--pages-search-query、--poll-seconds、--poll-timeout、--dry-run(打印有效负载,无请求)。
olostep crawl "https://docs.example.com" --max-pages 50 --formats markdown,html
olostep crawl "https://example.com" --max-pages 10 --dry-run
batch-scrape: CSV
CSV 列:custom_id 或 id,以及 url。
| 选项 | 描述 |
|---|
--formats | markdown、html、json |
--country | 可选 |
--parser-id | 结构化提取解析器 |
--poll-seconds、--log-every、--items-limit | 轮询 / 分页 |
--dry-run | 仅打印有效负载 |
olostep batch-scrape urls.csv --formats markdown,html
batch-update: 批量元数据
需要 其中之一 --metadata-json 或 --metadata-file(JSON 对象)。
olostep batch-update "batch_abc123" --metadata-json '{"team":"growth"}'
默认 --out 路径
当省略 --out 时:
| 命令 | 默认 |
|---|
map | output/map.json |
answer | output/answer.json |
scrape | output/scrape.json |
scrape-get | output/scrape_get.json |
crawl | output/crawl_results.json |
batch-scrape | output/batch_results.json |
batch-update | output/batch_update.json |
全局标志
| 标志 | 描述 |
|---|
-V, --version | 版本 |
-h, --help | 帮助 |
相关文档
仓库: github.com/olostep-api/CLI
将 API 密钥保留在源代码控制之外;如果泄露,请旋转密钥。