> ## 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.

# 网页数据命令

> 抓取、搜索、映射、回答、提取和内容：从网页获取数据。

这些命令从网页获取数据。每个获取新数据的命令都会使用积分。要抓取整个网站，请参见[`olostep crawl`](https://docs.olostep.com/cli/reference/jobs#crawl)。要一次抓取多个URL，请参见[`olostep batch`](https://docs.olostep.com/cli/reference/jobs#batch)。

所有命令在终端中打印Markdown，并使用`--json`输出JSON。请参见[输出](https://docs.olostep.com/cli/usage.md#output)。

## scrape

抓取单个页面。`olostep scrape <url>`运行`olostep scrape create`。有关格式和选项，请参见[抓取](https://docs.olostep.com/features/scrapes.md)。

### olostep scrape create

将页面抓取为Markdown、HTML或结构化数据。

> [!NOTE]
>
> 使用积分。

```bash theme={null}
olostep scrape create [--formats string]... [--country text] [--wait integer] [--remove-css-selectors text] [--remove-class-names string]... [--parser json] [--llm-extract json] [--screen-size json] [--links-on-page json] [--metadata json] [--preview] [--url-to-scrape text] [--json] [--fields a,b] [--dry-run] [<url_to_scrape>]
```

简写：`olostep scrape <url>`。

**参数**

| 参数 | 描述 |
| - | - |
| `url_to_scrape` | 一个http(s) URL。可选；你也可以通过标志传递。 |

**标志**

| 标志 | 必需 | 描述 |
| - | - | - |
| `-f`, `--formats` | 否 | 输出格式，如`markdown`或`html`。重复标志或用逗号分隔值。 |
| `-c`, `--country` | 否 | 国家。 |
| `--wait` | 否 | 抓取前等待的毫秒数（0到60000）。 |
| `--remove-css-selectors` | 否 | 从页面中移除的CSS选择器。 |
| `--remove-class-names` | 否 | 要移除的类。重复标志或用逗号分隔值。 |
| `--parser` | 否 | 解析器配置。JSON对象或`@file.json`。 |
| `--llm-extract` | 否 | LLM提取配置。JSON对象或`@file.json`。 |
| `--screen-size` | 否 | 截图视口。JSON对象或`@file.json`。 |
| `--links-on-page` | 否 | 链接提取选项。JSON对象或`@file.json`。 |
| `--metadata` | 否 | 请求元数据。JSON对象或`@file.json`。 |
| `--url-to-scrape` | 否 | 与`url_to_scrape`参数相同。 |

也接受`--json`、`--fields`、`--dry-run`和`--preview`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep scrape https://example.com -f markdown
olostep scrape https://example.com -f markdown,html -c US --wait 2000
olostep scrape https://example.com -f markdown --json
```

### olostep scrape get

通过id显示以前的抓取。

```bash theme={null}
olostep scrape get [--json] [--fields a,b] <scrape_id>
```

**参数**

| 参数 | 描述 |
| - | - |
| `scrape_id` | 抓取id。 |

也接受`--json`和`--fields`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep scrape get <scrape_id>
```

## search

搜索网页。`olostep search "<query>"`运行`olostep search create`。请参见[搜索](https://docs.olostep.com/features/search.md)。

### olostep search create

搜索网页。

> [!NOTE]
>
> 使用积分。

```bash theme={null}
olostep search create [--options json] [--preview] [--query text] [--json] [--fields a,b] [--dry-run] [<query>]
```

简写：`olostep search "<query>"`。

**参数**

| 参数 | 描述 |
| - | - |
| `query` | 搜索查询。可选；你也可以通过标志传递。 |

**标志**

| 标志 | 必需 | 描述 |
| - | - | - |
| `--options` | 否 | 额外的公共搜索API选项。JSON对象或`@file.json`。 |
| `--query` | 否 | 与`query`参数相同。 |

也接受`--json`、`--fields`、`--dry-run`和`--preview`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep search "best hiking trails"
olostep search "olostep web scraping api" --json
```

### olostep search get

通过id显示以前的搜索。

```bash theme={null}
olostep search get [--json] [--fields a,b] <search_id>
```

**参数**

| 参数 | 描述 |
| - | - |
| `search_id` | 搜索id。 |

也接受`--json`和`--fields`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep search get <search_id>
```

## map

列出网站的URL。`olostep map <url>`运行`olostep map create`。请参见[地图](https://docs.olostep.com/features/maps.md)。

### olostep map create

发现网站的URL。

> [!NOTE]
>
> 使用积分。

```bash theme={null}
olostep map create [--include-urls string]... [--exclude-urls string]... [--search text] [--top-n integer] [--include-subdomain] [--preview] [--url text] [--json] [--fields a,b] [--dry-run] [<url>]
```

简写：`olostep map <url>`。

**参数**

| 参数 | 描述 |
| - | - |
| `url` | 一个http(s) URL。可选；你也可以通过标志传递。 |

**标志**

| 标志 | 必需 | 描述 |
| - | - | - |
| `--include-urls` | 否 | 包含的URL模式。重复标志或用逗号分隔值。 |
| `--exclude-urls` | 否 | 排除的URL模式。重复标志或用逗号分隔值。 |
| `--search` | 否 | 根据与查询的匹配程度对URL进行排名。 |
| `-n`, `--top-n` | 否 | 返回的URL最大数量。 |
| `--include-subdomain` | 否 | 包括子域名。 |
| `--url` | 否 | 与`url`参数相同。 |

也接受`--json`、`--fields`、`--dry-run`和`--preview`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep map https://example.com -n 20
olostep map https://example.com --search "pricing" -n 10
```

## answer

在网上研究一个问题。`olostep answer "<task>"`运行`olostep answer create`。请参见[回答](https://docs.olostep.com/features/answers.md)。

### olostep answer create

在网上研究一个问题或任务，并获得答案或你要求的JSON格式。

> [!NOTE]
>
> 使用积分。

```bash theme={null}
olostep answer create [--schema json] [--options json] [--preview] [--task text] [--json] [--fields a,b] [--dry-run] [<task>]
```

简写：`olostep answer "<task>"`。

**参数**

| 参数 | 描述 |
| - | - |
| `task` | 研究任务。可选；你也可以通过标志传递。 |

**标志**

| 标志 | 必需 | 描述 |
| - | - | - |
| `--schema` | 否 | 请求的JSON架构。JSON对象或`@file.json`。 |
| `--options` | 否 | 额外的回答选项。JSON对象或`@file.json`。 |
| `--task` | 否 | 与`task`参数相同。 |

也接受`--json`、`--fields`、`--dry-run`和`--preview`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep answer "Olostep做什么？"
olostep answer "J.K. Rowling的最新一本书是什么？" --schema '{"book_title":"","author":"","release_date":""}' --json
```

### olostep answer get

通过id显示以前的回答。

```bash theme={null}
olostep answer get [--json] [--fields a,b] <answer_id>
```

**参数**

| 参数 | 描述 |
| - | - |
| `answer_id` | 回答id。 |

也接受`--json`和`--fields`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep answer get <answer_id>
```

## extract

从页面中提取结构化数据。`olostep extract <url>`运行`olostep extract run`。请参见[LLM提取](https://docs.olostep.com/features/structured-content/llm-extraction.md)。

### olostep extract run

用简单的文字指令从页面中提取结构化数据。

> [!NOTE]
>
> 使用积分。

```bash theme={null}
olostep extract run (--instruction text) [--schema json] [--preview] [--url text] [--json] [--fields a,b] [--dry-run] [<url>]
```

简写：`olostep extract <url>`。

**参数**

| 参数 | 描述 |
| - | - |
| `url` | 一个http(s) URL。可选；你也可以通过标志传递。 |

**标志**

| 标志 | 必需 | 描述 |
| - | - | - |
| `-i`, `--instruction` | 是 | 要提取的内容。 |
| `--schema` | 否 | 可选的JSON架构。JSON对象或`@file.json`。 |
| `--url` | 否 | 与`url`参数相同。 |

也接受`--json`、`--fields`、`--dry-run`和`--preview`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep extract https://example.com -i "提取产品价格"
olostep extract https://example.com/team -i "列出每个人的名字和角色" --json
```

## content

读取你已抓取或爬取的页面，而无需再次抓取它们。

### olostep content retrieve

获取你已抓取或爬取的页面的存储HTML、Markdown或JSON。`retrieve_id`来自`scrape create`、`scrape get`、`crawl pages`（Retrieve ID列）或`batch items`。像`scrape_abc123`这样的抓取id也可以使用。

```bash theme={null}
olostep content retrieve [--formats string]... [--json] [--fields a,b] <retrieve_id>
```

**参数**

| 参数 | 描述 |
| - | - |
| `retrieve_id` | 页面的retrieve\_id，例如abc123（或其抓取id，scrape\_abc123）。 |

**标志**

| 标志 | 必需 | 描述 |
| - | - | - |
| `-f`, `--formats` | 否 | 返回的格式：`html`、`markdown`或`json`。省略则返回所有存储格式。重复标志或用逗号分隔值。 |

也接受`--json`和`--fields`。请参见[全局标志](https://docs.olostep.com/cli/usage.md#global-flags)。

```bash theme={null}
olostep content retrieve <retrieve_id> -f markdown
olostep content retrieve scrape_abc123 -f html,markdown --json
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.