Live data from Hacker News

Show HN: Interactively select the quality and format for youtube-dl

github.com

21–30 of 95 posts

Re: Show HN: Interactively select the quality and format for youtube-dl

#23

People gotta realize that Node.js is actually excellent for this sort of task. It hits quite a few sweet spots as an all-round Unix scripting language: * Familiar syntax and semantics (Bash/Zsh/Fish/Csh/Ksh/Ash/Wtfsh are all way weirder than JS - and they are _only_ scripting languages, while JS is already everywhere) * Standard library ( https://nodejs.org/dist/latest-v12.x/docs/api/fs.html ) gives you access to POS…

All of these features are things other languages have too (I personally disagree that npm's "download the world" model is better than Python's envs). A huge drawback Node has is that it's not installed by default on any Linux distribution I know of, so I'd take a Python script over a Node one any day. Compiled languages have an even better distribution story, and Rust's Cargo is nothing to laugh at.

I'm not sure what you hope your posted comparisons show, but the Go "monstrosity" seems to have many more features than the Node one.

Re: Show HN: Interactively select the quality and format for youtube-dl

#24
post #3

I just have an alias with the format codes I want in order of preference (youtube-dl allows that) That's a very nice interactive ui though

You don't even need an alias, you can just stick the flag in ~/.config/youtube-dl/config instead.

Re: Show HN: Interactively select the quality and format for youtube-dl

#25
post #3

I just have an alias with the format codes I want in order of preference (youtube-dl allows that) That's a very nice interactive ui though

Can you post the alias?

It's well-documented in youtube-dl's readme: https://github.com/ytdl-org/youtube-dl#format-selection

It has examples as well: https://github.com/ytdl-org/youtube-dl#format-selection-exam...

Re: Show HN: Interactively select the quality and format for youtube-dl

#26

People gotta realize that Node.js is actually excellent for this sort of task. It hits quite a few sweet spots as an all-round Unix scripting language: * Familiar syntax and semantics (Bash/Zsh/Fish/Csh/Ksh/Ash/Wtfsh are all way weirder than JS - and they are _only_ scripting languages, while JS is already everywhere) * Standard library ( https://nodejs.org/dist/latest-v12.x/docs/api/fs.html ) gives you access to POS…

Sure, the the node code uses fewer lines than the Go code. But what you’ve failed to notice is the Go code calls APIs directly rather than fork()ing and does so within its own code base (how many lines of code is in the countless imports of your node example?). Plus the Go code also has unit tests which the others don’t.

Line numbers are always a terrible metric for proving anything but in this case your especially abusing that data.

Re: Show HN: Interactively select the quality and format for youtube-dl

#27

Earlier quoted context omitted.

Can you post the alias?

It's well-documented in youtube-dl's readme: https://github.com/ytdl-org/youtube-dl#format-selection It has examples as well: https://github.com/ytdl-org/youtube-dl#format-selection-exam...

Oh nice, thank you, I never saw the examples page.

Re: Show HN: Interactively select the quality and format for youtube-dl

#28

People gotta realize that Node.js is actually excellent for this sort of task. It hits quite a few sweet spots as an all-round Unix scripting language: * Familiar syntax and semantics (Bash/Zsh/Fish/Csh/Ksh/Ash/Wtfsh are all way weirder than JS - and they are _only_ scripting languages, while JS is already everywhere) * Standard library ( https://nodejs.org/dist/latest-v12.x/docs/api/fs.html ) gives you access to POS…

Look, I'm generally with you, there isn't anything particularly bad about modern JavaSscript, and it's a perfectly fine language to write your tools in if that's what you like.

But your points are... Weird.

1. Familiar to people who know JavaScript, sure. But shell is the language you interact with the CLI with, so more people who use the CLI are familiar with a shell.

2. Most languages have a standard library.

3. I know many people who would disagree with you. Anyway, pip works fine in a Unix environment, which is what we're discussing here.

4. We're talking about glue code, right? Glue doesn't tend to be very parallel.

5. So, perfect Unix glue? Sure, you like it, and that's great for you! Keep on doing you. It's obviously capable of making nice tools, but so are most languages...

6. You luks-suspend example is weird because the Node.js code obviously does so much less than the other versions. I have no idea what the Go version is doing, but the shell version does things like remount the filesystem, handle udev, etc... A bash version of the JavaScript code would be shorter!

7. 0.1+0.2!=0.3 is a result of floating point arithmetic being floating point arithmetic. It's not specific to JavaScript.

Re: Show HN: Interactively select the quality and format for youtube-dl

#30
post #26

People gotta realize that Node.js is actually excellent for this sort of task. It hits quite a few sweet spots as an all-round Unix scripting language: * Familiar syntax and semantics (Bash/Zsh/Fish/Csh/Ksh/Ash/Wtfsh are all way weirder than JS - and they are _only_ scripting languages, while JS is already everywhere) * Standard library ( https://nodejs.org/dist/latest-v12.x/docs/api/fs.html ) gives you access to POS…

Sure, the the node code uses fewer lines than the Go code. But what you’ve failed to notice is the Go code calls APIs directly rather than fork()ing and does so within its own code base (how many lines of code is in the countless imports of your node example?). Plus the Go code also has unit tests which the others don’t. Line numbers are always a terrible metric for proving anything but in this case your especially a…

In absence of more accessible complexity measurements, line counts do matter somewhat. E.g. the briefer a program is, the more readable it is (last time I checked, brainpower and time is much more expensive than computing power and bandwidth.)

The Node example has zero external dependencies outside of the Node.js standard library.

Post reply on HN