Scority

youtube-transcript-api Migration to Scority

Move from local youtube-transcript-api scripts to Scority's HTTP API with clear differences around auth, response shape, errors, and limits.

Direct answer

This is a migration, not a drop-in replacement

The open-source youtube-transcript-api package runs inside your Python process. Scority is a hosted HTTP API that returns normalized transcript JSON. Moving between them means changing authentication, request construction, error handling, and operational limits.

  • Use x-api-key from server-side configuration.
  • Request transcripts with video_id or video_url.
  • Expect text, segments, source, and language in successful responses.
  • Handle normalized API errors instead of library exceptions.
  • Do not assume every YouTube video has accessible captions.
Key differences

What changes in your Python code

The main change is that transcript retrieval moves from an in-process library call to a server-side HTTP request. That makes auth, retries, quota, and observability explicit.

Authentication

Scority requests require x-api-key. Store it in server-side environment variables, not notebooks, client apps, or public repos.

Open →

Response shape

Scority returns text, segments, source, and language. Segments include text, start, and duration.

Open →

Errors

Plan for invalid_video_id, unauthorized, rate_limited, quota_exceeded, transcript_not_available, and upstream_transcript_failed.

Open →
Example

After migration: HTTP request

Use the API from server-side Python. This example reads the key from the server-side environment and keeps it out of browser code.

import os
import requests

response = requests.get(
    "https://api.scority.ai/v1/youtube/transcript",
    headers={"x-api-key": os.environ["SCORITY_API_KEY"]},
    params={
        "video_id": "dQw4w9WgXcQ",
        "language": "en",
    },
    timeout=30,
)

body = response.json()

if not response.ok:
    code = body.get("error", {}).get("code", "transcript_request_failed")
    raise RuntimeError(code)

segments = body["segments"]
text = body["text"]
Checklist

Migration checklist

Before routing production traffic through Scority, test the videos, languages, and error cases that matter to your app.

  • Replace local library calls with server-side HTTPS requests.
  • Keep API keys out of frontend code and logs.
  • Map Scority error codes to your app's retry and user-message behavior.
  • Respect Retry-After and X-RateLimit headers for 429 responses.
  • Update data parsing to use text and timestamped segments.
  • Test language-specific requests with language or lang, but do not send both.
Limits

What not to assume

The migration should not rely on claims that are not true in production. Scority does not promise a transcript for every video and does not expose a public web proxy at /api/transcript. Fallback processing is available for supported accounts and harder videos, but it is not a drop-in guarantee for every failed library call.

Rate limits

Short-window rate limits and monthly quota are separate.

Open →

Language behavior

Language-aware cache buckets keep default and language-specific requests separate.

Open →

OpenAPI

Use the OpenAPI spec to inspect the current public contract.

Open →