How does youtube video downloader works?

There are a lot of plugins and also dedicated websites to download videos from youtube. How do that work. Or can some one shed some light on how to make a youtube video downloader?