YouTubeTranscriptNet (youtubetranscript_net v0.1.0)

Copy Markdown View Source

Elixir client for the YouTubeTranscript.net API.

{:ok, client} = YouTubeTranscriptNet.new()   # reads YTT_API_KEY
{:ok, result} = YouTubeTranscriptNet.Transcripts.get(client, "https://www.youtube.com/watch?v=jNQXAC9IVRw")

Every call returns {:ok, value} or {:error, %YouTubeTranscriptNet.Error{}}. The calls live in YouTubeTranscriptNet.Transcripts, YouTubeTranscriptNet.Batches and YouTubeTranscriptNet.Account.

Summary

Functions

Builds a client.

The SDK version.

Functions

new(opts \\ [])

@spec new(keyword()) ::
  {:ok, YouTubeTranscriptNet.Client.t()}
  | {:error, YouTubeTranscriptNet.Error.t()}

Builds a client.

Options:

  • :api_key - defaults to the YTT_API_KEY environment variable. Without either, returns an error with code API_KEY_REQUIRED and sends nothing.
  • :base_url - defaults to YTT_BASE_URL, then https://api.youtubetranscript.net.
  • :timeout - milliseconds for one HTTP request (default 60_000).
  • :max_retries - automatic retries for retryable failures (default 2).
  • :transport - a 5-arity function, see YouTubeTranscriptNet.Transport.
  • :sleep - a 1-arity function taking milliseconds (tests pass a fake).

new!(opts \\ [])

Same as new/1, but raises YouTubeTranscriptNet.Error.

version()

@spec version() :: String.t()

The SDK version.