> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/cn/web-unblocker/migration-guides/from-bright-data-web-unlocker.md).

# 从 Bright Data Web Unlocker

了解关键差异和迁移流程，从 **Bright Data Web Unlocker** 到 [**Oxylabs 网页解锁器**](https://oxylabs.io/products/web-unblocker). 查看示例代码片段和功能对比，确保平滑迁移。

## 功能对比

[**Oxylabs 网页解锁器**](https://oxylabs.io/products/web-unblocker) 提供了 Bright Data Web Unlocker 中大多数可用功能，以及若干独特能力。下表突出显示了这两项服务之间的主要差异：

| 功能             | Bright Data Web Unlocker           | Oxylabs 网页解锁器              |
| -------------- | ---------------------------------- | -------------------------- |
| Proxy Endpoint | brd.superproxy.io:33335            | unblock.oxylabs.io:60000   |
| API 端点         | <https://api.brightdata.com/wsapi> | 尚不支持（如需 API 功能，请使用网页爬虫API） |
| 代理轮换           | 自动                                 | 自动                         |
| 验证码处理          | 支持                                 | 支持（基于 AI）                  |
| 定价             | 高级域名单独定价                           | 统一价格                       |
| 地理位置定向         | 支持                                 | 支持                         |
| 移动端定向          | 支持                                 | 不支持                        |
| 自定义请求头/Cookie  | 支持                                 | 支持                         |
| JS 渲染          | 自动                                 | 手动（更多控制）                   |
| 渲染选项           | HTML                               | HTML 和 PNG                 |
| 浏览器说明          | 不支持                                | 支持                         |
| POST 请求        | 不支持                                | 支持                         |
| 会话             | 不支持                                | 支持                         |
| 自定义状态码         | 不支持                                | 支持                         |

## 发起请求

### 基本请求格式差异

Bright Data 和 Oxylabs 请求的主要区别在于地理位置的处理方式。Bright Data 使用特定区域账户，而 Oxylabs 允许你通过在请求头中传递位置信息，立即使用来自所有位置的代理。

#### **Bright Data 示例**

```python
import pprint
import requests

username = 'brd-customer-<customer_id>-zone-<zone_name>-country-us'
password = '<zone_password>'
proxy_url = f'http://{username}:{password}@brd.superproxy.io:33335'

代理 = {
    'http': proxy_url,
    'https': proxy_url
}

headers = {}
url = "http://lumtest.com/myip.json"

response = requests.get(url, proxies=proxies, headers=headers)
pprint.pprint(response.json())
```

#### **Oxylabs 示例**

```python
import requests

# 在此使用您的网页解锁器凭据
USERNAME, PASSWORD = 'YOUR_USERNAME', 'YOUR_PASSWORD'

# 定义代理字典
代理 = {
  'http': f'http://{USERNAME}:{PASSWORD}@unblock.oxylabs.io:60000',
  'https': f'https://{USERNAME}:{PASSWORD}@unblock.oxylabs.io:60000',
}

headers = {
    'x-oxylabs-geo-location': '美国'
}

response = requests.request(
    'GET',
    'https://ip.oxylabs.io/headers',
    verify=False,  # 忽略 SSL 证书
    代理=代理,
    headers=headers
)

print(response.text)
```

## Oxylabs 网页解锁器的独特功能

### 持久会话

Oxylabs 网页解锁器的一项独特功能是会话功能，可让你通过同一个代理发送多个请求。通过在请求中添加自定义会话 ID 标头，会话最长可使用 10 分钟：

```python
headers = {
    'X-Oxylabs-Session-Id': '123randomString'
}

response = requests.get(
    'https://ip.oxylabs.io/location',
    verify=False,  # 忽略证书所需
    代理=代理,
    headers=headers,
)
```

有关会话的更多信息，请查看 [**网页解锁器会话文档页面。**](/products/cn/web-unblocker/making-requests/session.md)

### POST 请求

与 Bright Data Web Unlocker 不同，Oxylabs 网页解锁器支持向网页端点发送 POST 请求：

```python
data = {
    'Your POST JSON': 'data'
}

response = requests.post(
    'https://ip.oxylabs.io/location',
    verify=False,  # 忽略证书所需
    代理=代理,
    json=data,
)
```

有关 POST 请求的更多详情，请参阅 [**网页解锁器 POST 请求文档。**](#post-requests)

### JavaScript 渲染和浏览器指令

Oxylabs 网页解锁器提供自定义浏览器指令功能，并带有无头浏览器模式，可将结果页面的 JavaScript 渲染为 HTML 文档或 PNG 截图。此外，在网页解锁器中使用无头浏览器时，你可以定义在 JavaScript 渲染期间执行的自定义浏览器指令。

有关此功能的更多信息，请参阅 [**网页解锁器自定义浏览器指令文档。**](/products/cn/web-unblocker/custom-browser-instructions.md)

## 参数参考

以下是主要 [**参数和标头**](/products/cn/web-unblocker/making-requests/headers.md) 你可以与 Oxylabs 网页解锁器一起使用：

| 参数                             | 描述                                    | 示例                |
| ------------------------------ | ------------------------------------- | ----------------- |
| X-Oxylabs-Geo-Location         | 指定请求的地理位置                             | '美国'、'德国'等。       |
| X-Oxylabs-Session-Id           | 创建或继续具有指定 ID 的会话                      | '123randomString' |
| X-Oxylabs-Render               | 当设置为 'html' 或 'png' 时启用 JavaScript 渲染 | 'html', 'png'     |
| X-Oxylabs-Browser-Instructions | 用于渲染的自定义浏览器指令                         | 包含指令的 JSON        |

## 迁移检查清单

1. 将你的 Proxy Endpoint 从 `brd.superproxy.io:33335` 到 `unblock.oxylabs.io:60000`
2. 将基于 zone 的地理定位替换为 `X-Oxylabs-Geo-Location` 标头
3. 将身份验证凭据更新为你的 Oxylabs 代理用户的用户名和密码
4. 添加 `verify=False` 在请求中以忽略 SSL 证书验证
5. 充分利用 Oxylabs 的独特功能，如会话和 POST 请求


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/products/cn/web-unblocker/migration-guides/from-bright-data-web-unlocker.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
