| ▲ | est 3 days ago |
| I really appreciate the engineering effort went into this "JavaScript interpreter" https://github.com/yt-dlp/yt-dlp/blob/2025.09.23/yt_dlp/jsin... |
|
| ▲ | sirbranedamuj 3 days ago | parent | next [-] |
| This is the buried lede in this announcement for me - I had no idea they were already going to such lengths. It's really impressive! |
|
| ▲ | Aurornis 3 days ago | parent | prev | next [-] |
| This is perfect for the problem they were solving. Really cool that they took it this far to avoid adding further overhead. |
|
| ▲ | XnoiVeX 3 days ago | parent | prev | next [-] |
| It's a subset of Javascript. HN discussion here https://news.ycombinator.com/item?id=32794081 |
| |
| ▲ | extraduder_ire 3 days ago | parent | next [-] | | This description reminds me of program language wars excerpt I saw somewhere years ago about how c was obviously superior to Pascal, because with enough preprocessor macros you can compile any Pascal program in c. Followed by some hideous and humorous examples. | |
| ▲ | ASalazarMX 3 days ago | parent | prev [-] | | This is amazing, an old school but effective approach in this modern age. I was afraid they were going to embed a browser. |
|
|
| ▲ | codedokode 3 days ago | parent | prev | next [-] |
| I decided just to look at the code for a moment and discovered ChainMap in Python. |
| |
| ▲ | ddtaylor 3 days ago | parent | next [-] | | This is excellent for some of my usages. I want to have my AI agents "fork" their context in some ways, this could be useful for that instead of juggling a tree of dictionaries. | |
| ▲ | bjackman 2 days ago | parent | prev [-] | | Ha, that's cool. I have implemented a crappy and probably broken version of this type before. Next time I won't have to! |
|
|
| ▲ | LordShredda 3 days ago | parent | prev | next [-] |
| I'm on mobile, this seems like an actual js interpreter that only does objects and arithmetic. Impressive that it went that far |
|
| ▲ | supriyo-biswas 3 days ago | parent | prev | next [-] |
| Heh, now I wonder how much JavaScript it actually interprets and given that it’s < 1000 lines, whether it could be used towards an introductory course in compilers. |
| |
| ▲ | kccqzy 3 days ago | parent | next [-] | | Obviously not. An introductory course would introduce concepts like lexers, parsers, AST, etc, instead of working on strings. Here are lines 431 through 433: if expr.startswith('new '):
obj = expr[4:]
if obj.startswith('Date('):
| | | |
| ▲ | Too 3 days ago | parent | prev [-] | | There’s a famous presentation by David Beazley where he implements a WASM interpreter in Python in under an hour. Highly recommended. | | |
| ▲ | bangaladore 3 days ago | parent [-] | | Bytecode interpreters are quite simple compared to the actual lexer / parser. |
|
|
|
| ▲ | jokoon 3 days ago | parent | prev | next [-] |
| Wait I thought they were running an entire browser engine |
| |
| ▲ | ddtaylor 3 days ago | parent [-] | | Over time they probably will require that. I believe YT still allows most of these things because of "legacy" apps, which they have been killing off bit by bit. I'm not sure if anyone is cataloging the oldest supported app, but most things like using YT from a slightly older game console don't work anymore. Basically any publicly known method that can sip video content with doing the least work and authentication will be a common point of attack for this. |
|
|
| ▲ | stevage 3 days ago | parent | prev | next [-] |
| heh, that's pretty cool. |
|
| ▲ | jollyllama 3 days ago | parent | prev [-] |
| I wonder how long until it gets split off into its own project. For the time being, it could do with a lot more documentation. At least they've got some tests for it! |
| |
| ▲ | CaptainOfCoit 3 days ago | parent | next [-] | | > I wonder how long until it gets split off into its own project The submission is literally about them moving away from it in favor of Deno, so I think "never" probably gets pretty close. | | |
| ▲ | jollyllama 3 days ago | parent [-] | | Thanks for explaining - I didn't understand that this is what was being replaced. |
| |
| ▲ | zahlman 3 days ago | parent | prev [-] | | Aside from the fact that the point of the announcement is that they're dropping it entirely, this "interpreter" is a hack that definitely is nowhere near capable of interpreting arbitrary JS. For example, the only use of `new` it handles is for Date objects, which it does by balancing parens to deduce the arguments for the call, then treating the entire group of arguments as a string and applying regexes to that. |
|