For the complete documentation index, see llms.txt. This page is also available as Markdown.

Transcript

Extract YouTube video transcripts by video ID, with configurable language and transcript origin (auto-generated or uploader-provided).

You can get YouTube video transcripts by providing a YouTube video ID and a language_code to the youtube_transcript source.

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": "WOD0mZnu-j0",
        "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': 'WOD0mZnu-j0',
    '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

Parameter
Description
Default Value

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

callback_url

URL to your callback endpoint. More info

-

- mandatory parameter

Last updated

Was this helpful?