Videx v0.2.0 Videx.Youtube View Source
Link to this section Summary
Functions
Generate URL for Youtube video.
Generate embed HTML for Youtube video.
Check if the URL is valid video URL for Youtube.
Parse and extract information from Youtube video URL.
Link to this section Functions
Generate URL for Youtube video.
Examples
iex> Videx.Youtube.generate(%Videx.Youtube{id: "Hh9yZWeTmVM"})
"https://www.youtube.com/watch?v=Hh9yZWeTmVM"
iex> Videx.Youtube.generate("Hh9yZWeTmVM", :short, %{t: 80})
"https://youtu.be/Hh9yZWeTmVM?t=80"
Generate embed HTML for Youtube video.
Examples
iex> Videx.Youtube.html(%Videx.Youtube{id: "Hh9yZWeTmVM"})
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/Hh9yZWeTmVM\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
iex> Videx.Youtube.html("Hh9yZWeTmVM", width: 320, height: 240)
"<iframe width=\"320\" height=\"240\" src=\"https://www.youtube.com/embed/Hh9yZWeTmVM\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
Check if the URL is valid video URL for Youtube.
Examples
iex> Videx.Youtube.match?("https://www.youtube.com/watch?v=Hh9yZWeTmVM")
true
Parse and extract information from Youtube video URL.
Examples
iex> Videx.Youtube.parse("https://www.youtube.com/watch?v=Hh9yZWeTmVM")
%Videx.Youtube{id: "Hh9yZWeTmVM", params: %{}, type: :long}