How to Execute a Local Program from a Web Browser?

I am trying to automate downloading youtube videos but am struck.

I want to use the youtube-dl utility to download videos. But its tedious to copy the link each time and manually create a command line.

My idea is that as soon as I copy a youtube link, I need to get a popup asking me if I wish to download it and if yes, it needs to execute the youtube-dl.exe program on my machine to download the video.

I was thinking I could develop an extension to perform this but am not sure how to execute a command from the web browser.

Please guide me. Or am I approaching the problem in a wrong way? Please tell me if there is a better way to go about automating this task of mine.