YouTube Transcript
You can get YouTube video transcripts by providing a YouTube video ID and a language_code to the youtube_transcript source. (Note: Transcripts are not closed captions (CC).)
Request samples
The following examples demonstrate how to retrieve the English transcript of a YouTube video, specifically when the transcript was provided by the uploader.
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
"source": "youtube_transcript",
"query": "SLoqvcnwwN4",
"context": [
{
"key": "language_code",
"value": "en"
},
{
"key": "transcript_origin",
"value": "uploader_provided"
}
]
}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'youtube_transcript',
'query': 'SLoqvcnwwN4',
'context': [
{
'key': 'language_code',
'value': 'en'
},
{
'key': 'transcript_origin',
'value': 'uploader_provided'
}
]
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('user', 'pass1'),
json=payload,
)
# Print the JSON response with the result.
pprint(response.json())We use synchronous Realtime integration method in our examples. If you would like to use Proxy Endpoint, or asynchronous Push-Pull integration, refer to the Integration Methods section.
Request parameter values
Generic
source
Sets the scraper.
youtube_transcript
query
YouTube video ID.
-
context: language_code
Specifies the language of the transcript. Find available values here.
NOTE: If the provided language_code has no matching transcript in the YouTube video, the result returns a 404 status.
-
context:
transcript_origin (optional)
Specifies whether to retrieve transcripts that are auto_generated or uploader_provided.
auto_generated
- mandatory parameter
Last updated
Was this helpful?

