How does VLC open and play youtube videos? If you press Ctrl+N and enter the url of a youtube video, it loads for a few seconds and then plays the video.

How does it parse the HTML code?

  • How exactly does a positrack rear end on a Plymouth work, it just does,,,"Joe Dirt" – Moab May 30 '15 at 13:36

VLC has integrated the Lua scripting language to allow users to do things at different times in the playback pipeline. One of the extension points that VLC exposes via Lua is called a playlist extensions. With this type of extension, you can take the URL passed to VLC and transform it to a new URL or set of URLs.

VLC ships with some default Lua extensions, one of which is the youtube.lua extension. You can read the code for yourself there, but basically the script takes the video URL and pulls in the HTML and parses it to get the video metadata and a URL it can use to play.

Just as a side note, you can see the compiled Lua scripts that ship with VLC in the <VLC_INSTALL_DIR>/lua directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.