> ## Documentation Index
> Fetch the complete documentation index at: https://help.decodo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Proxies for Video Download 

> Optimized proxies for the yt_dlp integration

## What Are Proxies for Video Download, and How Can You Get Started?

Proxies for Video Download are specialized servers designed to optimize and facilitate access to video content. They act as intermediaries between a user's device and servers, allowing users to mask their IP addresses, bypass regional restrictions, and access content that may be blocked.

Contact our sales team to access our Proxies for Video Download and receive a customized proxy endpoint tailored to your specific requirements. Our experts will work closely with you to understand your needs and ensure seamless integration, providing high-performance solutions designed to support your content delivery.

### Authentication

We'll provide you with `user:pass` authentication and a proxy endpoint with port (the default is `7001`)

### cURL Example

```shellscript cURL theme={null}
curl -x "username-test:password@endpoint:7001" "https://ip.decodo.com/json"
```

> 📘 Maintaing Sessions
>
> Adding the session variable `-test` to the username will allow the IP address to persist for multiple requests.

### Getting a New IP

To rotate the IP to a new one, add a random value between `1`-`100000` to the username as a parameter (`$((1 + RANDOM % 100000))`)

```shellscript cURL theme={null}
curl -x "username-$((1 + RANDOM % 100000)):password@endpoint:7001" \
     "https://ip.decodo.com/json"
```

***

## Integration with (yt\_dlp) tool for video downloads

### Example Request

<CodeGroup>
  ```text Command Line theme={null}
  yt-dlp --proxy username-test:password@endpoint:7001 \
  "https://www.youtube.com/watch?v=zJwHKgj5BwM"
  ```

  ```python Python theme={null}
  import yt_dlp

  username = 'YOUR_USERNAME'
  password = 'YOUR_PASSWORD'

  if not username.endswith("-test"):
      username += "-test"

  proxy = f'http://\{username\}:{password}@endpoint:7001'
  ydl_opts = {
      'proxy': proxy,
  }

  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
      ydl.download(['https://www.youtube.com/watch?v=zJwHKgj5BwM'])
  ```
</CodeGroup>

<Info>
  * By default, the system uses the same IP for all video downloads, however, **the same IP should only be used for one-time tests**.
  * For optimal performance and to prevent potential throttling, it is mandatory to download each video using a distinct IP address for every video. For detailed instructions on how to implement this, see the following section.
</Info>

### Multiple URLs with Unique IPs

When downloading multiple videos, consider using a different IP for each. Here are examples to achieve this:

<CodeGroup>
  ```text Command Line theme={null}
  # First video with one IP
  yt-dlp --proxy username-$((1 + RANDOM % 100000)):password@endpoint:7001 \
  "https://www.youtube.com/watch?v=7NrKMceE6Wk"

  # Second video with different IP
  yt-dlp --proxy username-$((1 + RANDOM % 100000)):password@endpoint:7001 \
  "https://www.youtube.com/watch?v=mQqw0pLcGXU"
  ```

  ```python Python theme={null}
  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}@endpoint:7001'

      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=7NrKMceE6Wk',
          'https://www.youtube.com/watch?v=mQqw0pLcGXU'
      ]
      
      for video in videos:
          download_with_new_ip(video, username, password)

  if __name__ == "__main__":
      main()
  ```
</CodeGroup>
