Oxylabs Video Data
YouTube data extraction via API and high-bandwidth proxies for video/audio downloading.
Two Approaches
Video Data API
Uses the same endpoint as Web Scraper API with YouTube-specific sources.
Endpoint
POST https://realtime.oxylabs.io/v1/queries # immediate metadata/search/subtitle responses
POST https://data.oxylabs.io/v1/queries # Push-Pull downloads, callbacks, storage
Content-Type: application/json
Authentication
curl -u "$OXY_WSA_USERNAME:$OXY_WSA_PASSWORD" ...
Available Sources
Source Parameters
For youtube_download, use Push-Pull and cloud storage. storage_type is gcs, s3, or s3_compatible; download_type is audio, video, or audio_video; video_quality is best, worst, or 144, 360, 480, 720, 1080, 1440, 2160, 4320.
Downloads default to 720p when available and are limited to 1 hour. start_at/end_at use hh:mm:ss; end_at must be later than start_at. For batch downloads, use /v1/queries/batch with a query array only; keep all other parameters singular.
Quick Start
Video metadata:
curl -X POST 'https://realtime.oxylabs.io/v1/queries' \
-u "$OXY_WSA_USERNAME:$OXY_WSA_PASSWORD" \
-H 'Content-Type: application/json' \
-d '{
"source": "youtube_metadata",
"query": "dQw4w9WgXcQ",
"parse": true
}'
YouTube search:
curl -X POST 'https://realtime.oxylabs.io/v1/queries' \
-u "$OXY_WSA_USERNAME:$OXY_WSA_PASSWORD" \
-H 'Content-Type: application/json' \
-d '{
"source": "youtube_search",
"query": "python tutorial"
}'
Channel data:
curl -X POST 'https://realtime.oxylabs.io/v1/queries' \
-u "$OXY_WSA_USERNAME:$OXY_WSA_PASSWORD" \
-H 'Content-Type: application/json' \
-d '{
"source": "youtube_channel",
"channel_handle": "@channelhandle",
"parse": true,
"limit": 10
}'
High-Bandwidth Proxies (Video Downloads)
For actual video/audio file downloads using yt-dlp.
Setup
Contact Oxylabs sales team to get a dedicated high-bandwidth endpoint.
Default configuration:
- Port:
60000
- Endpoint: Provided after purchase
Use OXY_HB_ENDPOINT; if absent, check OXYLABS_HB_ENDPOINT.
Connection Test
curl -x "http://USERNAME-test:PASSWORD@YOUR_ENDPOINT:60000" \
"https://ip.oxylabs.io/location"
yt-dlp Integration
With session rotation (different IP per download):
yt-dlp --proxy "http://USERNAME-Random1Session2ID:PASSWORD@YOUR_ENDPOINT:60000" \
"https://www.youtube.com/watch?v=VIDEO_ID"
Change the session ID for each download to get a fresh IP.
Python with yt-dlp
import yt_dlp
import os
import uuid
username = os.environ["OXY_WSA_USERNAME"]
password = os.environ["OXY_WSA_PASSWORD"]
endpoint = os.environ["OXY_HB_ENDPOINT"] # Your dedicated endpoint
# Random session for unique IP
session_id = str(uuid.uuid4()).replace("-", "")
ydl_opts = {
"proxy": f"http://{username}-{session_id}:{password}@{endpoint}:60000",
"format": "best",
"outtmpl": "%(title)s.%(ext)s"
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download(["https://www.youtube.com/watch?v=VIDEO_ID"])
Choosing the Right Method
For more examples, see examples.md.