A tool to list or to retrieve video transcriptions from Youtube.
Add youtex
to the list of dependencies inside mix.exs
:
def deps do
[
{:youtex, "~> 0.2.0"}
]
end
There are 2 main functions:
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 need to pattern match {:ok, data}
and {:error, reason}
, there are also trailing bang versions for every function.