> 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). Agents can also search and read this documentation through its [MCP server](https://developers.oxylabs.io/~gitbook/mcp).

# 高带宽代理

了解如何将 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 %}

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

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

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

```bash
# First video with one IP
yt-dlp --proxy username-$(openssl rand -hex 16):password@endpoint:60000 \\
"https://www.youtube.com/watch?v=6stlCkUDG_s"

# Second video with different 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 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/cn/proxies/high-bandwidth-proxies.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
