YOUTUBE API

Transcript

Retrieve transcript from YouTube with a single API request.

GET/api/data/v1/youtube/video/transcript
1credit base costZero-credit cache supported

Request parameters

Up to 1 credit

YouTube video or short URL

Language code, ie 'en', 'es', 'fr' or 'en-US'. Overrides the default track selection unless original_audio=true. If omitted, prefers captions matching the original spoken language when YouTube identifies the original audio. If that metadata

Set to true to return captions only in the original spoken language identified by YouTube. Takes precedence over language. If the original audio cannot be reliably identified or has no matching captions, transcript, transcript_only_text, an

If we have a response in the cache that is this many days old or newer, return the cached response (0 credits, with "cached": true and a "cached_at" timestamp). Otherwise, scrape a live result (1 credit). [See the Caching page for details.]

Try in the console

Live requests use your prepaid balance. Cached responses cost zero where supported.

curl --request GET \
  --url 'https://fetchgoblin.com/api/data/v1/youtube/video/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbjVIDXPP7Uk' \
  --header 'x-api-key: YOUR_FETCHGOBLIN_API_KEY'

Response

Example
{
  "success": true,
  "credits_charged": 1,
  "videoId": "bjVIDXPP7Uk",
  "type": "video",
  "url": "https://www.youtube.com/watch?v=bjVIDXPP7Uk",
  "transcript": [
    {
      "text": "welcome back to the hell farm and the",
      "startMs": "160",
      "endMs": "1920",
      "startTimeText": "0:00"
    }
  ],
  "transcript_only_text": "welcome back to the hell farm and the backyard trails we built these jumps two years ago and last year we just kind of rebuilt them and this year......",
  "language": "English"
}
Example data from the API specification. Run a request to retrieve current data.

Response shape

This schema describes the documented data shape. Some platform fields may be absent or null. The response also includes your FetchGoblin request ID and current credit balance.

View JSON Schema +
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "credits_remaining": {
      "type": "integer"
    },
    "credits_charged": {
      "type": "integer"
    },
    "videoId": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "transcript": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "startMs": {
            "type": "string"
          },
          "endMs": {
            "type": "string"
          },
          "startTimeText": {
            "type": "string"
          }
        }
      }
    },
    "transcript_only_text": {
      "type": "string"
    },
    "language": {
      "type": "string"
    }
  }
}