YouTubeTranscriptNet.Batches (youtubetranscript_net v0.1.0)

Copy Markdown View Source

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

Summary

Functions

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

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

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 /v1/batch/{batch_id}. Returns %{"batch", "items", "nextPageToken"}. Options: :max_results, :page_token.

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

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.

Functions

create(client, opts)

@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(client, batch_id)

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

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

export(client, batch_id, opts \\ [])

@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(client, batch_id, opts \\ [])

@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(client, batch_id)

@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(client, batch_id, opts \\ [])

@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.