Batch fetch playlist transcripts

Fetch transcripts for all videos in a playlist with concurrency control.

POST
/api/playlist/{id}/transcript

Path Parameters

id*string

Playlist ID or URL

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

import { Router } from 'express'import { transcribePlaylist } from 'lyra-sdk/transcript'import { z } from 'zod'const router = Router()const batchSchema = z.object({  concurrency: z.coerce.number().min(1).max(20).optional().default(3),  from: z.coerce.number().min(1).optional(),  to: z.coerce.number().min(1).optional(),  lang: z.string().optional(),})router.post('/playlist/:id/transcript', async (req, res) => {  const { id } = req.params  const opts = batchSchema.parse(req.body)  const result = await transcribePlaylist(id, {    apiKey: process.env.YOUTUBE_API_KEY!,    ...opts,  })  res.json(result)})export const routes = router
{
  "playlistId": "string",
  "totalVideos": 0,
  "requestedRange": [
    0,
    0
  ],
  "succeeded": 0,
  "failed": 0,
  "results": [
    {
      "videoId": "string",
      "title": "string",
      "position": 0,
      "status": "string",
      "lines": [
        {
          "text": "string",
          "duration": 0,
          "offset": 0,
          "lang": "string"
        }
      ],
      "error": "string"
    }
  ]
}
{
  "error": {
    "code": 0,
    "message": "string",
    "details": [
      "string"
    ]
  }
}
{
  "error": {
    "code": 0,
    "message": "string",
    "details": [
      "string"
    ]
  }
}