高带宽代理 (High-Bandwidth Proxies)
了解 Oxylabs 高带宽代理以及如何将其用于视频或音频抓取任务。
快速开始
要开始使用我们的 高带宽代理 (High Bandwidth Proxies) 用于 视频数据和音频抓取,请联系销售团队以获取您的专用端点。每位客户都会获得为其特定需求配置的唯一代理端点。要将此解决方案直接集成到 yt_dlp 库,请参考此页面:
端点配置
在从客户经理团队收到端点后,您将获得:
一个专用代理端点
您的用户名和密码
端口号(默认:60000)
发起请求
为快速连接检查,请在用户名中添加 -test 参数。
curl -x username-test:password@your-endpoint:60000 \
https://ip.oxylabs.io/locationimport requests
import random
username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'
proxy = 'your-endpoint:60000'
if not username.endswith("-test"):
username += "-test"
proxies = {
"http": f"http://{username}:{password}@{proxy}",
"https": f"http://{username}:{password}@{proxy}"
}
response = requests.get(
"https://ip.oxylabs.io/location",
proxies=proxies
)
print(response.text)const axios = require('axios');
const https = require('https');
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const proxyHost = 'your-endpoint';
const proxyPort = 60000;
const client = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
const modifiedUsername = username.endsWith("-test") ? username : username + "-test";
client.get('https://ip.oxylabs.io/location', {
proxy: {
host: proxyHost,
port: proxyPort,
auth: {
username: modifiedUsername,
password: password
}
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));<?php
$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
$proxyHost = 'your-endpoint';
$proxyPort = 60000;
$modifiedUsername = substr($username, -5) === "-test" ? $username : $username . "-test";
$proxy = "$proxyHost:$proxyPort";
$ch = curl_init('https://ip.oxylabs.io/location');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$modifiedUsername:$password");
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>package main
import (
"fmt"
"io"
"net/http"
"net/url"
"strings"
)
func main() {
username, password := "YOUR_USERNAME", "YOUR_PASSWORD"
proxyHost := "your-endpoint"
proxyPort := "60000"
if !strings.HasSuffix(username, "-test") {
username += "-test"
}
proxyURL := fmt.Sprintf("http://%s:%s@%s:%s", username, password, proxyHost, proxyPort)
proxy, _ := url.Parse(proxyURL)
transport := &http.Transport{Proxy: http.ProxyURL(proxy)}
client := &http.Client{Transport: transport}
req, _ := http.NewRequest("GET", "https://ip.oxylabs.io/location", nil)
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String username = "YOUR_USERNAME";
String password = "YOUR_PASSWORD";
if (!username.endsWith("-test")) {
username += "-test";
}
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
});
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress("your-endpoint", 60000)))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ip.oxylabs.io/location"))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}using System.Net;
var proxy = new WebProxy
{
Address = new Uri("http://your-endpoint:60000"),
Credentials = new NetworkCredential("YOUR_USERNAME-test", "YOUR_PASSWORD")
};
var handler = new HttpClientHandler { Proxy = proxy };
var client = new HttpClient(handler);
var response = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(response);
为每次下载设置会话
为确保最佳成功率,高带宽代理在每个会话期间提供自动负载均衡。 -$((1 + RANDOM % 100000)) 用户名旁的该参数会生成一个随机数作为会话 ID,并为每次下载分配不同的 IP 地址。
curl -x username-$((1 + RANDOM % 100000)):password@your-endpoint:60000 \
https://ip.oxylabs.io/locationimport requests
import random
username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'
proxy = 'your-endpoint:60000'
random_number = random.randint(1, 100000) # 生成随机数
modified_username = f"{username}-{random_number}"
proxies = {
"http": f"http://{modified_username}:{password}@{proxy}",
"https": f"http://{modified_username}:{password}@{proxy}"
}
response = requests.get(
"https://ip.oxylabs.io/location",
proxies=proxies,
)
print(response.text)const axios = require('axios');
const https = require('https');
const username = 'YOUR_USERNAME';
const password = 'YOUR_PASSWORD';
const randomNumber = Math.floor(Math.random() * 100000) + 1;
const modifiedUsername = `${username}-${randomNumber}`;
const client = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
client.get('https://ip.oxylabs.io/location', {
proxy: {
host: 'your-endpoint',
port: 60000,
auth: {
username: username,
password: password
}
},
})
.then(response => console.log(response.data))
.catch(error => console.error(error));<?php
$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
$proxy = 'your-endpoint:60000';
$sessionId = rand(1, 100000);
$modifiedUsername = $username . "-" . $sessionId;
$ch = curl_init('https://ip.oxylabs.io/location');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "$modifiedUsername:$password");
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>package main
import (
"fmt"
"io"
"math/rand"
"net/http"
"net/url"
)
func main() {
username, password:= "YOUR_USERNAME", "YOUR_PASSWORD"
proxyHost:= "your-endpoint"
proxyPort:= "60000"
modifiedUsername:= fmt.Sprintf("%s-%d", username, rand.Intn(100000)+1)
proxyURL:= fmt.Sprintf("http://%s:%s@%s:%s", modifiedUsername, password, proxyHost, proxyPort)
proxy, _:= url.Parse(proxyURL)
transport:= &http.Transport{Proxy: http.ProxyURL(proxy)}
client:= &http.Client{Transport: transport}
req, _:= http.NewRequest("GET", "https://ip.oxylabs.io/location", nil)
resp, err:= client.Do(req)
if err!= nil {
panic(err)
}
defer resp.Body.Close()
body, _:= io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.Authenticator;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.ProxySelector;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Random;
public class Main {
public static void main(String[] args) throws Exception {
String username = "YOUR_USERNAME";
String password = "YOUR_PASSWORD";
Random rand = new Random();
int randomNumber = rand.nextInt(100000) + 1;
String modifiedUsername = username + "-" + randomNumber;
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(modifiedUsername, password.toCharArray());
}
});
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress("your-endpoint", 60000)))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ip.oxylabs.io/location"))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}using System.Net;
var random = new Random();
int sessionId = random.Next(1, 100001); // 生成 1 到 100000 之间的随机数
var proxy = new WebProxy
{
Address = new Uri("http://your-endpoint:60000"),
Credentials = new NetworkCredential($"YOUR_USERNAME-{sessionId}", "YOUR_PASSWORD") // 在用户名后追加 sessionId
};
var handler = new HttpClientHandler { Proxy = proxy };
var client = new HttpClient(handler);
var response = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(response);最后更新于
这有帮助吗?

