YouTubeTranscriptNet.Transport (youtubetranscript_net v0.1.0)

Copy Markdown View Source

How the SDK talks HTTP. A transport is a 5-arity function:

(method, url, headers, body, timeout_ms) ->
  {:ok, %{status: integer, headers: %{lowercase_name => value}, body: binary}}
  | {:error, :timeout}
  | {:error, reason}

method is :get, :post or :delete; headers is a list of {name, value} strings; body is a JSON string or nil. Any {:error, reason} other than :timeout becomes a NETWORK_ERROR. The default is YouTubeTranscriptNet.Transport.Httpc; pass your own (for example one built on Req or Finch) with YouTubeTranscriptNet.new(transport: fun). The transport must not retry: retries are the SDK's job.

Summary

Types

response()

@type response() :: %{
  status: non_neg_integer(),
  headers: %{required(String.t()) => String.t()},
  body: binary()
}

t()

@type t() :: (atom(),
        String.t(),
        [{String.t(), String.t()}],
        binary()
        | nil,
        non_neg_integer() ->
          {:ok, response()} | {:error, term()})