Videx is a simple video url parser for parsing and generating video urls.
Parse Youtube video url.
Videx.parse("https://www.youtube.com/watch?v=Hh9yZWeTmVM")
# %Videx.Youtube{id: "Hh9yZWeTmVM", params: %{}, type: :long}
Generate Youtube video url.
video = %Videx.Youtube{id: "Hh9yZWeTmVM"}
Videx.Youtube.generate(video, :long)
# "https://www.youtube.com/watch?v=Hh9yZWeTmVM"
Here is how you can convert Youtube video url to another format.
"https://www.youtube.com/watch?v=Hh9yZWeTmVM"
|> Videx.parse()
|> Videx.Youtube.generate(:short)
# "https://youtu.be/Hh9yZWeTmVM"
Add Videx to your mix.exs
:
def deps do
[
{:videx, "~> 0.2.0"}
]
end
After that, run mix deps.get
.
Current Features or To-Do
Videx is under MIT license. Check the LICENSE file for more details.