# YouTube & podcast transcript API

> Any audio URL → timestamped chunks. Sync or async.

- Endpoint: `POST https://scrapenest.dev/v1/audio/transcript`
- Price: 20 / 2 min
- Category: Media
- Reference: https://scrapenest.dev/docs#ep-audio
- Web page: https://scrapenest.dev/catalog/audio-transcript
- Updated: 2026-11-04

A general-purpose audio transcription endpoint. Resolves the audio asset behind YouTube, X Spaces, SoundCloud, Apple Podcasts, Overcast, Facebook video, TikTok, and direct MP3/M4A/WAV/OGG URLs, then transcribes with timestamps. For anything longer than ~90 seconds, use the async variant: POST to /v1/audio/transcript/async, get a run_id back, poll /v1/scrape/runs/{run_id}.

## The hard part

Every host hides its audio differently, and the URLs age out on different schedules. Even when you find the file, transcribing a 90-minute episode takes longer than most networks will hold a single request open. We resolve the audio per host and ship an async variant so long jobs don't die on a timeout halfway through.

## Transcript API: what you get

- Sources: YouTube, X Spaces, SoundCloud, podcast episodes (Apple Podcasts or Overcast episode pages, or an episode's audio file URL from an RSS feed; feed URLs are not accepted), Facebook video, TikTok, direct MP3 / M4A / WAV / OGG.
- Sync at `/v1/audio/transcript`, async at `/v1/audio/transcript/async` (returns 202 + run_id).
- Per-chunk timestamps. Optional `language` hint for accuracy.
- If part of a recording can't be transcribed, you get the rest with `partial: true` and `missing_ranges`, billed only for the covered time and never cached.
- `cookies` (Netscape cookies.txt for gated YouTube audio) and `include_usage` supported.

## Transcript API use cases

- **Show notes and chapters**: Group the timestamped `chunks` into chapters and summaries for each episode.
- **Video search and RAG**: Embed transcript chunks with their `start` and `end` times so answers can link to the exact moment.
- **Captions and accessibility**: Build caption files from the chunk timings for videos you publish.

## Transcript API quickstart

Install an SDK with `pip install scrapenest` or `npm install scrapenest`, or call the HTTP API directly with your key in the `Authorization: Bearer` header. No key yet? Sign up free at https://scrapenest.dev/signup, verify your email, then create a key in your dashboard.

### Python SDK

```python
import os
from scrapenest import Client

client = Client(os.environ["SCRAPENEST_API_KEY"])
run = client.audio_transcript_async("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
final = client.wait_for_run(run.run_id, timeout=1800)
if final.status == "completed":
    print(final.result["text"][:400])
    for chunk in (final.result.get("chunks") or [])[:3]:
        print(chunk["start"], chunk["end"], chunk["text"])
else:
    print(final.error_code, final.error_message)
```

### Node SDK

```javascript
import { ScrapeNest } from "scrapenest";

const client = new ScrapeNest({ apiKey: process.env.SCRAPENEST_API_KEY });
const run = await client.audioTranscriptAsync({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" });
const final = await client.waitForRun(run.run_id, { timeout: 1_800_000 });
if (final.status === "completed") console.log(String(final.result?.text ?? "").slice(0, 400));
else console.log(final.error_code, final.error_message);
```

### curl

```bash
curl -X POST https://scrapenest.dev/v1/audio/transcript/async \
  -H "Authorization: Bearer sn_••••" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }'
```

### Python (httpx)

```python
import httpx, time

base = "https://scrapenest.dev"
headers = {"Authorization": "Bearer sn_••••"}

submitted = httpx.post(
    f"{base}/v1/audio/transcript/async",
    headers=headers,
    json={"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"},
).json()
run_id = submitted["run_id"]

while True:
    run = httpx.get(f"{base}/v1/scrape/runs/{run_id}", headers=headers).json()
    if run["status"] in ("completed", "failed"):
        break
    time.sleep(2)
print(run["result"]["chunks"][:3])
```

### JavaScript (fetch)

```javascript
const headers = {
  "Authorization": "Bearer sn_••••",
  "Content-Type": "application/json",
};
const start = await fetch("https://scrapenest.dev/v1/audio/transcript/async", {
  method: "POST",
  headers,
  body: JSON.stringify({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }),
});
const { run_id } = await start.json();
while (true) {
  const run = await (await fetch(
    `https://scrapenest.dev/v1/scrape/runs/${run_id}`,
    { headers },
  )).json();
  if (["completed", "failed"].includes(run.status)) break;
  await new Promise((r) => setTimeout(r, 2000));
}
```

### Go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "time"
)

func main() {
    body, _ := json.Marshal(map[string]string{
        "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    })
    req, _ := http.NewRequest("POST",
        "https://scrapenest.dev/v1/audio/transcript/async",
        bytes.NewReader(body))
    req.Header.Set("Authorization", "Bearer sn_••••")
    req.Header.Set("Content-Type", "application/json")
    r, _ := http.DefaultClient.Do(req)
    var submitted struct{ RunID string `json:"run_id"` }
    json.NewDecoder(r.Body).Decode(&submitted)
    r.Body.Close()

    for {
        poll, _ := http.NewRequest("GET",
            "https://scrapenest.dev/v1/scrape/runs/"+submitted.RunID, nil)
        poll.Header.Set("Authorization", "Bearer sn_••••")
        pr, _ := http.DefaultClient.Do(poll)
        var run struct{ Status string }
        json.NewDecoder(pr.Body).Decode(&run)
        pr.Body.Close()
        fmt.Println(run.Status)
        if run.Status == "completed" || run.Status == "failed" { break }
        time.Sleep(2 * time.Second)
    }
}
```

## Transcript API request and response

### Request body

```json
{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "language": "en"
}
```

### Response

```json
{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "audio_url": "https://rr5---sn-...googlevideo.com/...mp4",
  "title": "Never Gonna Give You Up",
  "channel": "Rick Astley",
  "duration_seconds": 213.0,
  "language": "en",
  "source": "youtube",
  "chunks": [
    {"start": 0.0, "end": 3.1, "text": "We're no strangers to love"}
  ],
  "text": "We're no strangers to love... [full transcript]",
  "took_ms": 8400,
  "cache_hit": false,
  "credits_charged": 40
}
```

Fields with no value are left out of the JSON rather than sent as `null`, so read optional fields defensively.

## Transcript API pricing

20 credits per 2 minutes of audio, rounded up. Same pricing on the async variant. Cache hits bill at 1.

- The edge timeout is ~100 s. Anything longer than ~90 s of audio should use the async variant: same pricing, no timeout risk.

## Transcript API limits

- Up to 4 hours or 250 MB of audio per request.
- Anything longer than about 90 seconds of audio should use `/v1/audio/transcript/async`; the edge timeout is ~100 s.
- Podcast feed URLs are rejected: pass one episode URL.
- `cookies`: Netscape cookies.txt content up to 128 KB, for gated YouTube audio. Requests with cookies are never cached.
- Cache: 30 days by default (`cache_ttl_seconds` up to 2,592,000).

## Transcript API error codes

| HTTP | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_audio_source` | The URL is a podcast feed, not an episode. |
| 400 | `audio_resolve_failed` | No audio could be found at the URL. |
| 401 | `login_required` | The source needs a signed-in session: pass `cookies`. |
| 403 | `audio_private` | The audio is private or members-only. |
| 413 | `audio_too_long, audio_too_large` | Longer than 4 hours or larger than 250 MB. |
| 422 | `drm_protected` | The audio is DRM-protected. |
| 503 | `transcribe_timeout` | Transcription ran out of time. Use the async variant. |

Every endpoint can also return `401 unauthorized` (missing or wrong key), `402 insufficient_credits` (balance used up), `403 email_not_verified` (an email signup must verify its address before its key works) and `429 rate_limited` or `concurrency_limit_exceeded`. All errors share one JSON envelope; see the [error reference](https://scrapenest.dev/docs#errors).

## Transcript API FAQ

### How do I transcribe a YouTube video with an API?

POST the watch URL and you get back the transcript as both a single text field and timestamped chunks. We resolve the underlying audio ourselves, so you never handle signature decryption or expiring media URLs. For anything longer than about 90 seconds use the async variant so the job isn't racing the request timeout.

### Which audio sources are supported?

YouTube, X Spaces, SoundCloud, podcast episodes (Apple Podcasts or Overcast episode pages, or an episode's audio file URL from an RSS feed; feed URLs are not accepted), Facebook video, TikTok, and direct MP3 / M4A / WAV / OGG links. Each host hides its audio differently and those URLs expire on different schedules, which is the part this endpoint absorbs for you.

### Do I get timestamps?

Yes. Every response includes a `chunks` array where each entry carries `start`, `end`, and `text`, which is what you need to build captions, jump-to links, or chunked embeddings for RAG.

### How long can the audio be?

Up to 4 hours per request. Anything past roughly 90 seconds should go through `/v1/audio/transcript/async`: you get a `run_id` back immediately and poll `/v1/scrape/runs/{run_id}` until it completes. A 90-minute episode transcribes fine that way; it just can't finish inside a single synchronous request.

### What does transcription cost?

20 credits per 2 minutes of audio, rounded up, and identical on the async variant. A cache hit bills 1 credit, so re-requesting the same episode while it's still cached is effectively free.

## Related endpoints

- [Translation API with flat per-call pricing](https://scrapenest.dev/catalog/translate.md): `POST /v1/translate`. 28 languages. Flat per-call price. Drop-in REST that scales with calls, not characters.
- [AI answer API with citations](https://scrapenest.dev/catalog/search-answer.md): `POST /v1/search/answer`. RAG-style. Search, fetch, summarise with numbered [1][2] citations.
- [Web scraping API for any URL](https://scrapenest.dev/catalog/scrape-url.md): `POST /v1/scrape/url`. Point us at a page. We get past the wall and hand back the rendered HTML and clean text.

## Get 1,000 free credits

Every account starts on the Free plan: 1,000 credits a month, no card. Verify your email, then mint an API key and make this call. Sign up at https://scrapenest.dev/signup.
