# 参数说明

了解 Thordata 的 网页解锁器 - 抓取参数。

**`Token`（必填）：**

该参数定义了爬取时使用的 API 令牌。对于您的成功爬取起到决定性作用。

<table><thead><tr><th width="66">参数</th><th width="114">名称</th><th width="237">作用</th></tr></thead><tbody><tr><td>token</td><td>Token</td><td>爬取时验证的 API 令牌</td></tr></tbody></table>

**`URL`（必填）：**

该参数定义了爬取的目的网站链接，默认值为 google.com。您也可以更改为其他搜索引擎链接。

<table><thead><tr><th width="66">参数</th><th width="114">名称</th><th width="237">作用</th></tr></thead><tbody><tr><td>url</td><td>URL</td><td>爬取的目的网站的链接</td></tr></tbody></table>

**示例请求：**

带有`token`:<mark style="color:blue;">Token ,</mark>`url`:<mark style="color:blue;"><https://www.google.com></mark> 的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True"
```

<details>

<summary><code>js_render</code> <strong>，</strong>JS渲染<strong>(非必填)</strong></summary>

JS渲染能够处理动态加载的内容和单页应用(SPA)，支持更交互复杂的页面和渲染需求，建议您开启。

`js_render`=True

`js_render`=False

**示例请求：**

带有 `js_render`:<mark style="color:blue;">True</mark> 的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True"
```

</details>

<details>

<summary><code>type</code> <strong>，</strong>输出格式<strong>(非必填)</strong></summary>

该参数定义了抓取结果的输出格式。可选择HTML和PNG格式，默认为HTML。

`format`=HTML

`format`=PNG

**示例请求：**

带有 `type`:<mark style="color:blue;">png</mark> 的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=png" -d "js_render=True"
```

</details>

<details>

<summary><code>block_resources</code><strong>，</strong>阻止<strong>(非必填)</strong></summary>

该参数可限止不必要的资源抓取，从而加快抓取速度。

`block_resources`=图片

`block_resources`=Javascript脚本

**示例请求：**

带有`block_resources`:<mark style="color:blue;">script</mark> 的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True" -d "block_resources=script"
```

</details>

<details>

<summary><code>country</code><strong>，代理(非必填)</strong></summary>

该参数定义了爬取时的代理使用哪个国家/地区，默认值无代理。

`country`=随机

`country`=任意国家代码

**示例请求：**

带有 `country`:<mark style="color:blue;">al</mark> 的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request -H "Authorization: Bearer Token" -H "Content-Type: application/x-www-form-urlencoded" -d "url=https://www.google.com" -d "type=html" -d "js_render=True" -d "country=al"
```

</details>

<details>

<summary><code>clean_content</code><strong>，清除(非必填)</strong></summary>

此参数用于从返回结果中删除 `JS` 和 `CSS` 内容。

**示例请求：**

带有 `clean_content`: `JS` 和 `CSS` 的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request \
 -H "Authorization: Bearer token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "url=https://www.google.com" \
 -d "type=html" \
 -d "js_render=True" \
 -d "clean_content=js,css" \
 -d "header=False"
```

</details>

<details>

<summary><code>wait</code><strong>，等待（毫秒）(非必填)</strong></summary>

等待页面在指定时间内加载内容（以毫秒为单位）。最大值：100,000 毫秒（100 秒）

**示例请求：**

带有`wait`:<mark style="color:blue;">1000</mark>的参数示例

```sh
curl -X POST https://webunlocker.thordata.com/request \
 -H "Authorization: Bearer token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "url=https://www.google.com" \
 -d "type=html" \
 -d "js_render=True" \
 -d "wait=10000"
```

</details>

<details>

<summary><code>wait_for</code> <strong>，等待选择器(非必填)</strong></summary>

等待 CSS 選擇器在 DOM 中載入，若同時使用 `wait_for` 和 `wait`，則以 `wait_for` 為優先（覆蓋固定時間）。指定元素最長等待 30 秒，超時後會自動返回網站內容。

**示例请求：**

带有帶有 `wait_for:1000` 的參數示例

```sh
curl -X POST https://webunlocker.thordata.com/request \
 -H "Authorization: Bearer token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "url=https://www.google.com" \
 -d "type=html" \
 -d "js_render=True" \
 -d "wait=10000" \
 -d "wait_for=.content"
```

</details>

<details>

<summary><code>headers</code><strong>，自定义headers(非必填)</strong></summary>

向目标网站传递自定义请求头，多个 headers 时请用英文逗号‘,’分隔；\
HTTP标头是键值对，以冒号 (:) 分隔。发送的参数应采用 JSON 格式。

**示例请求：**

如果您想发送 `User-Agent` 和 `Content-Type`，则应如下所示：

```sh
curl -X POST https://webunlocker.thordata.com/request \
 -H "Authorization: Bearer token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "url=https://www.google.com" \
 -d "type=html" \
 -d "js_render=token" \
 -d 'headers=[{"name":"name1","value":"value1"}]' \
 -d 'cookies=[{"name":"name2","value":"value2"}]'
```

</details>

<details>

<summary><code>cookies</code><strong>，</strong>Cookies<strong>(非必填)</strong></summary>

将自定义 `cookie` 传递给目标网站，多个 `cookies` 时请用英文分号‘;’分隔。

&#x20;`cookie`是网站通过网络浏览器存储在用户设备上的小块数据。

`cookie`允许网站保留用户信息，例如登录状态、偏好设置或追踪详情，从而改善和个性化浏览体验。&#x20;

发出请求时，您可以通过两种方式添加 `cookie` :

在 `headers` 参数中：（例如：{"`"Cookie`":"`cookie_name_1=cookie_value_1`"}）

直接使用cookies: （例如：{"`"Cookie`":"`cookie_name_1=cookie_value_1`"}）

**示例请求：**

使用此专用cookies参数：以以下格式直接传递它们： `cookie_name_1=cookie_value_1; cookie_name_2=cookie_value_2`

```sh
curl -X POST https://webunlocker.thordata.com/request \
 -H "Authorization: Bearer token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "url=https://www.google.com" \
 -d "type=html" \
 -d "js_render=token" \
 -d 'headers=[{"name":"name1","value":"value1"}]' \
 -d 'cookies=[{"name":"name2","value":"value2"}]'
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.thordata.com/doc/zh/pa-qu/web-unlocker/can-shu-shuo-ming.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
