> 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/proxies/high-bandwidth-proxies.md).

# 高带宽代理

学习如何将 Oxylabs 高带宽代理用于流量密集型任务，如视频和音频爬取。

## 入门指南

要开始使用我们的 [**高带宽代理**](https://oxylabs.io/products/high-bandwidth-proxies) 用于视频数据和音频抓取，请联系我们的销售团队以获取专用端点。每位客户都会获得一个根据其特定需求配置的唯一代理端点。要将此解决方案直接集成到 `yt_dlp` 库中，请查看 [示例](#example-integration-youtube-downloader) 下方，或查看我们的 [Agent Skills](#agent-skills) 用于 AI 工作流。

## 端点配置

在从客户管理团队收到端点后，你将获得：

* 一个专用代理端点
* 你的用户名和密码
* 端口号（默认： `60000`)

## 示例集成：YouTube Downloader

这里有一个使用 `yt-dlp` 结合我们的高带宽代理进行视频或音频数据抓取的示例：

### 基本用法

{% tabs %}
{% tab title="Bash" %}

```bash
yt-dlp --proxy username-$(openssl rand -hex 16):password@endpoint:60000 \
"https://www.youtube.com/watch?v=WNCl-69POro"
```

{% endtab %}

{% tab title="Python" %}

```python
import os
import yt_dlp

username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'

proxy = f'http://{username}-{os.urandom(16).hex()}:{password}@your-endpoint:60000'

ydl_opts = {
    'proxy': proxy,
}

with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=WNCl-69POro'])
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
为获得最佳性能，请确保每个视频都使用单独的 IP 地址下载。有关指导，请参考下面的部分。
{% endhint %}

### 多个使用不同 IP 的 URL

在使用高带宽代理时，每个视频都会使用单独的 IP 地址下载，以确保最佳性能。这通过为每个请求生成唯一的会话 ID 来实现，从而有效地为每次下载分配一个新的 IP 地址。

{% tabs %}
{% tab title="Bash" %}

```bash
# 第一个视频使用一个 IP
yt-dlp --proxy username-$(openssl rand -hex 16):password@endpoint:60000 \
"https://www.youtube.com/watch?v=6stlCkUDG_s"

# 第二个视频使用不同的 IP
yt-dlp --proxy username-$(openssl rand -hex 16):password@endpoint:60000 \
"https://www.youtube.com/watch?v=gsnqXt7d1mU"
```

{% endtab %}

{% tab title="Python" %}

```python
import os
import yt_dlp

def download_with_new_ip(url, username, password):
    session_id = os.urandom(16).hex()
    proxy = f'http://{username}-{session_id}:{password}@your-endpoint:60000'

    ydl_opts = {
        'proxy': proxy
    }
    
    with yt_dlp.YoutubeDL(ydl_opts) as ydl:
        try:
            print(f"Downloading {url} with new IP ({username}-{session_id})...")
            ydl.download([url])
            print(f"Successfully downloaded {url}")
        except Exception as e:
            print(f"Error downloading {url}: {str(e)}")

def main():
    username = 'YOUR_USERNAME'
    password = 'YOUR_PASSWORD'
    
    videos = [
        'https://www.youtube.com/watch?v=6stlCkUDG_s',
        'https://www.youtube.com/watch?v=gsnqXt7d1mU'
    ]
    
    for video in videos:
        download_with_new_ip(video, username, password)

if __name__ == "__main__":
    main()

```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
该函数包含基本错误处理，以确保即使一个下载失败，流程也能继续。
{% endhint %}

## Agent Skills

要在 AI 工作流中使用 Oxylabs 高带宽代理，你还可以使用 Agent Skills (`skills.md`) 用于教导 LLM 和 AI 编码助手如何配置并与 Oxylabs 产品交互。

该 `视频数据` agent skill 可帮助你的模型配置原始视频/音频媒体流和下载，通过 `yt-dlp` 不出现语法或参数幻觉。

{% hint style="info" %}
**注意：** `视频数据` 该技能还包括通过网页爬虫API进行结构化数据收集（搜索结果、元数据等）。 [了解更多](/products/cn/web-scraper-api/solutions-for-ai-workflows/agent-skills.md#video-data).
{% endhint %}

### 安装

#### Claude Code（插件市场）

在 Claude Code 中，运行以下命令：

```
/插件市场 添加 Oxylabs/agent-skills
/plugin install oxylabs@oxylabs-agent-skills
```

这会将全部 5 个技能安装为一个插件：

* [`skills/代理`](https://github.com/oxylabs/agent-skills/blob/main/skills/proxies/SKILL.md)
* [`skills/web-unblocker`](https://github.com/oxylabs/agent-skills/blob/main/skills/web-unblocker/SKILL.md)
* [`skills/web-scraper-api`](https://github.com/oxylabs/agent-skills/blob/main/skills/web-scraper-api/SKILL.md)
* [`skills/headless-browser`](https://github.com/oxylabs/agent-skills/blob/main/skills/headless-browser/SKILL.md)
* [`skills/video-data`](https://github.com/oxylabs/agent-skills/blob/main/skills/video-data/SKILL.md)

要更新技能，请运行此命令：

```
/plugin marketplace update oxylabs-agent-skills
```

#### 其他代理（通用）

对于其他代理和自定义环境，请通过标准 skills CLI 将仓库加载到你的项目工作区中：

```
npx skills add https://github.com/oxylabs/agent-skills.git
```

### 配置

所有 Oxylabs Agent Skills 都通过在一个 `.env` 文件中定义的环境变量进行身份验证。要使用 `视频数据` 这些技能，请将这些键添加到你的 `.env` 文件中：

| 变量                 | 描述                                                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `OXY_HB_ENDPOINT`  | 你的高带宽代理网关                                                                                                          |
| `OXY_WSA_USERNAME` | （可选）你的网页爬虫API用户 `用户名`. [了解更多](/products/cn/web-scraper-api/solutions-for-ai-workflows/agent-skills.md#video-data). |
| `OXY_WSA_PASSWORD` | （可选）你的网页爬虫API用户 `密码`. [了解更多](/products/cn/web-scraper-api/solutions-for-ai-workflows/agent-skills.md#video-data).  |

### 如何使用

一旦该技能激活，你就可以提示你的 AI 助手生成经过网络优化的媒体传递脚本。

* **示例 1：** "创建一个 shell 脚本，将我的 `OXY_HB_ENDPOINT` 网关配置直接传递到 `yt-dlp` 用于从 URL 下载原始视频。"
* **示例 2：** "编写一个使用 `ffmpeg` 以及代理轮换，以通过高带宽入口节点传输大型二进制视频资源。\\"


---

# 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/proxies/high-bandwidth-proxies.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.
