# `YouTubeTranscriptNet.Transcripts`
[🔗](https://github.com/youtube-transcript/youtubetranscript-elixir/blob/v0.1.0/lib/youtubetranscript_net/transcripts.ex#L1)

Transcripts of single videos, and your transcript library.

`video` is a YouTube link (watch, youtu.be, Shorts) or an 11-character video id.
`language` is a priority list such as `"en"`, `"pt-BR,pt"`, `"auto"` (the video's own
captions) or `"asr"` (speech-to-text when there are no captions).

# `delete`

```elixir
@spec delete(YouTubeTranscriptNet.Client.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, YouTubeTranscriptNet.Error.t()}
```

`DELETE /v1/library/transcripts/youtube/{video_id}`. Returns `%{"removed" => true}`. Option: `:language`.

# `download`

```elixir
@spec download(YouTubeTranscriptNet.Client.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, YouTubeTranscriptNet.Error.t()}
```

Downloads a saved transcript as a string. Options: `:format` (`"txt"` default, `"srt"`,
`"vtt"`, `"json"`, `"md"`), `:language`.

# `get`

```elixir
@spec get(YouTubeTranscriptNet.Client.t(), String.t(), keyword()) ::
  {:ok, YouTubeTranscriptNet.TranscriptResult.t()}
  | {:error, YouTubeTranscriptNet.Error.t()}
```

Gets a transcript and waits for it: `POST /v1/transcript`, then polls the job while it
is pending (speech-to-text, long videos).

Options: `:language`, `:format` (`"json"` default, or `"text"` for `result.text`),
`:include_timestamp`, `:send_metadata`, `:confirm_credits` (accept a cost above 10
credits), `:timeout` (ms to wait in total, default `300_000`), `:poll_interval`
(ms, default `2_000`).

Errors: `TIMEOUT` (with `job_id`) when the job is not done in time; a failed job returns
its own `error.code` (or `TRANSCRIPT_FAILED`) with `status: 0` and `job_id`.

# `info`

```elixir
@spec info(YouTubeTranscriptNet.Client.t(), String.t()) ::
  {:ok, map()} | {:error, YouTubeTranscriptNet.Error.t()}
```

`GET /v1/transcript/info`: video details and caption languages. Free.

# `job`

```elixir
@spec job(YouTubeTranscriptNet.Client.t(), String.t()) ::
  {:ok,
   YouTubeTranscriptNet.TranscriptResult.t() | YouTubeTranscriptNet.Job.t()}
  | {:error, YouTubeTranscriptNet.Error.t()}
```

`GET /v1/transcript/job/{job_id}`: a `TranscriptResult` once finished, otherwise a `Job`.

# `list`

```elixir
@spec list(YouTubeTranscriptNet.Client.t(), keyword()) ::
  {:ok, map()} | {:error, YouTubeTranscriptNet.Error.t()}
```

`GET /v1/library/transcripts`. Returns `%{"transcripts", "total", "page", "pageSize", "langs"}`.

Options: `:q`, `:lang`, `:sort`, `:page`, `:page_size`.

# `submit`

```elixir
@spec submit(YouTubeTranscriptNet.Client.t(), String.t(), keyword()) ::
  {:ok,
   YouTubeTranscriptNet.TranscriptResult.t() | YouTubeTranscriptNet.Job.t()}
  | {:error, YouTubeTranscriptNet.Error.t()}
```

Sends the request once and returns the first answer as-is: a `TranscriptResult`
(`status: "success"`) or a `Job` (`pending` / `processing`, with `job_id`).

Options: those of `get/3` except `:timeout` and `:poll_interval`, plus `:wait_ms`
(how long the server may hold the request, up to `10_000`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
