Earlier quoted context omitted.
Embedding a whole js engine and then interopping with it from python would be non trivial. Good luck fixing any bugs or corner cases you hit that way. The V8 and spidermonkey embedding apis are both c++ (iirc) and non trivial to use correctly. Having full control like this +simple code is probably lower risk and more maintainable, even if there's the challenge of expanding feature set if scripts change. The alternati…
apparently yt-dlp is somehow calling out to a js engine if available
Another option is to use node, but it also has weird limitations/behaviors when running code.