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

Bulk transcription of many videos, a playlist or a channel. Available once the account
has bought a credit pack.

# `create`

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

`POST /v1/batch` with exactly one of `:items` (a list of links), `:playlist` or
`:channel`; also `:language`, `:limit`, `:name`. Returns the batch map.

Never retried automatically: a repeat could charge twice. Passing none or more than one
source returns `INVALID_REQUEST` without sending anything.

# `delete`

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

`DELETE /v1/library/batches/{batch_id}`. Returns `%{"removed" => true}`.

# `export`

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

`GET /v1/batch/{batch_id}/export`. Returns the file as a binary (zip by default).
Options: `:format` (`"zip"`, `"csv"`, `"txt"`, `"json"`, `"srt"`, `"vtt"`), `:files`,
`:timestamps` (boolean).

# `get`

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

`GET /v1/batch/{batch_id}`. Returns `%{"batch", "items", "nextPageToken"}`.
Options: `:max_results`, `:page_token`.

# `retry`

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

`POST /v1/batch/{batch_id}/retry`. Never retried automatically. Returns `%{"batch", "retried", "credits"}`.

# `wait`

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

Polls `get/3` until the batch is `completed` or `failed` and returns that last answer.
Options: `:timeout` (ms, default `1_800_000`), `:poll_interval` (ms, default `3_000`).
Returns `TIMEOUT` when the batch is not finished in time.

---

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