# High-Bandwidth Proxies

## Empezando

Para empezar a usar nuestros [**High Bandwidth Proxies** ](https://oxylabs.io/products/high-bandwidth-proxies)para la extracción de datos de video y audio, contacta a nuestro equipo de ventas para recibir tu endpoint dedicado. Cada cliente obtiene un proxy endpoint único configurado para sus necesidades específicas. Para integrar esta solución directamente con `yt_dlp` biblioteca, revisa la [sección de ejemplos](#example-integration-youtube-downloader).

## Configuración del endpoint

Después de recibir tu endpoint del equipo de gestión de cuentas, obtendrás:

* Un endpoint de proxy dedicado
* Tu nombre de usuario y contraseña
* Número de puerto (predeterminado: 60000)

## Realización de solicitudes

Para una comprobación rápida de la conexión, añade `-test` parámetro al nombre de usuario.

{% tabs %}
{% tab title="Línea de comandos" %}

```bash
curl -x username-test:password@your-endpoint:60000 \
     https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="Python" %}

```python
import 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)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
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));
```

{% endtab %}

{% tab title="PHP" %}

```php
<?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;
?>
```

{% endtab %}

{% tab title="Go" %}

```go
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))
}
```

{% endtab %}

{% tab title="Java" %}

```java
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());
    }
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
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);

```

{% endtab %}
{% endtabs %}

### Establecer una sesión para cada descarga

Para garantizar la tasa de éxito óptima, los proxies de alto ancho de banda incluyen balanceo de carga automatizado durante cada sesión. El `-$((1 + RANDOM % 100000))`  parámetro junto al nombre de usuario genera un número aleatorio como ID de sesión y asigna una dirección IP diferente para cada descarga.&#x20;

{% tabs %}
{% tab title="Línea de comandos" %}

```bash
curl -x username-$((1 + RANDOM % 100000)):password@your-endpoint:60000 \
     https://ip.oxylabs.io/location
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import random

username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'
proxy = 'your-endpoint:60000'

random_number = random.randint(1, 100000)  # Generar número aleatorio
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)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
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));
```

{% endtab %}

{% tab title="PHP" %}

```php
<?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;
?>
```

{% endtab %}

{% tab title="Go" %}

```go
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))
}
```

{% endtab %}

{% tab title="Java" %}

```java
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());
    }
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System.Net;

var random = new Random();
int sessionId = random.Next(1, 100001); // Genera un número aleatorio entre 1 y 100000

var proxy = new WebProxy
{
    Address = new Uri("http://your-endpoint:60000"),
    Credentials = new NetworkCredential($"YOUR_USERNAME-{sessionId}", "YOUR_PASSWORD") // Añade sessionId al nombre de usuario
};

var handler = new HttpClientHandler { Proxy = proxy };
var client = new HttpClient(handler);

var response = await client.GetStringAsync("https://ip.oxylabs.io/location");
Console.WriteLine(response);
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
El endpoint ajustado gestionará automáticamente la asignación de IP según tu configuración. Usarlo garantiza una nueva dirección IP para cada descarga.
{% endhint %}

## Ejemplo de integración: YouTube Downloader

Aquí tienes un ejemplo usando `yt-dlp` con nuestros High Bandwidth Proxies para la extracción de datos de video o audio:

### Uso básico

Añadir un `-test` parámetro al nombre de usuario permite a los usuarios probar la configuración de conexión.

{% tabs %}
{% tab title="Línea de comandos" %}

```bash
yt-dlp --proxy username-test:password@endpoint:60000 \
"https://www.youtube.com/watch?v=WNCl-69POro"
```

{% endtab %}

{% tab title="Python" %}

```python
import yt_dlp

username = 'YOUR_USERNAME'
password = 'YOUR_PASSWORD'

if not username.endswith("-test"):
    username += "-test"
    
proxy = f'http://{username}:{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" %}
Para un rendimiento óptimo, asegúrate de que cada video se descargue usando una dirección IP separada. Consulta la sección siguiente para obtener orientación.
{% endhint %}

### Múltiples URLs con diferentes IPs

Mientras usas High Bandwidth Proxies, cada video se descarga con una dirección IP separada para garantizar un rendimiento óptimo. Esto se logra generando un ID de sesión único para cada solicitud, lo que asigna eficazmente una nueva dirección IP para cada descarga.

{% tabs %}
{% tab title="Línea de comandos" %}

```bash
# Primer video con una IP
yt-dlp --proxy username-$((1 + RANDOM % 100000)):password@endpoint:60000 \
"https://www.youtube.com/watch?v=6stlCkUDG_s"

# Segundo video con una IP diferente
yt-dlp --proxy username-$((1 + RANDOM % 100000)):password@endpoint:60000 \
"https://www.youtube.com/watch?v=gsnqXt7d1mU"
```

{% endtab %}

{% tab title="Python" %}

```python
import random
import yt_dlp

def download_with_new_ip(url, username, password):
    session_id = random.randint(1, 100000)
    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" %}
La función incluye manejo básico de errores para garantizar que el proceso continúe incluso si falla una descarga.
{% endhint %}


---

# 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://developers.oxylabs.io/products/es/proxies/high-bandwidth-proxies.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.
