Youtex

Build Status

TODO: Add description

Installation

If available in Hex, the package can be installed by adding youtex to your list of dependencies in mix.exs:

def deps do
  [
    {:youtex, "~> 0.2.0"}
  ]
end

Usage

There are 2 main methods:

Youtex.list_transcripts(video_id)

Youtex.list_transcripts("lxYFOM3UJzo")

{:ok,
 [
   %Youtex.Transcript{
     generated: false,
     language_code: "en",
     name: "Inglês",
     sentences: [],
     url: "https://www.youtube.com/api/timedtext..."
   },
   %Youtex.Transcript{...},
   ...
 ]}

Youtex.get_transcription(video_id, language \ “en”)

Youtex.get_transcription("lxYFOM3UJzo")

{:ok,
 %Youtex.Transcript{
   generated: false,
   language_code: "en",
   name: "Inglês",
   sentences: [
     %Youtex.Transcript.Sentence{
       duration: 9.3,
       start: 9.53,
       text: "I remember like my first computer was a\nPentium 100 megahertz. I would be in"
     },
     %Youtex.Transcript.Sentence{...},
     ...
   ],
   url: "https://www.youtube.com/api/timedtext..."
 }}

If you don’t want or don’t need to pattern match {:ok, data} or {:error, reason}, there are also trailing bang versions for every one.

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/youtex.