Follow

Even though I'm almost certain there's an easier way to do this, I'm too lazy to learn it at the moment. :mario_flop: :blobblush: :doggoblob:

@hrisskar To be honest, I'm kind of overwhelmed by seeing that ` && youtube-dl`. It's convention for a CLI tool that accepts one path or URL as input to accept any number of them in a single invocation.

Also, single quotes are only needed for a YouTube or Invidious URL if it contains ampersands which the shell would otherwise interpret as the "run in background" version of a semicolon.

Example:

youtube-dl youtube.com/watch?v=cIANk7zQ05 youtube.com/watch?v=Pwe-pA6TaZ youtube.com/watch?v=_7X6Yeydgy

@ssokolow Sadly, youtube-dl sticks its nose straight up and REFUSES to work for me unless I add those single quotes. :doggoblob: Though IIRC it's because I'm using zsh rather than bash; took me a bit of websearching before I learned that's why youtube-dl wouldn't work after migrating from to ! :mario_flop:

@hrisskar That's odd. I'm also using zsh and it works fine here.

Probably some zsh config flag that Manjaro defaults differently to Debian-family distros.

Try sticking echo on the beginning of the command and see what it prints. Maybe it's interpreting the ? as a globbing character and it's configured to remove unmatched globs rather than passing them through as literals. (Bash has an option to do that too)

@ssokolow Something like this:

youtube-dl -ciw invidio.us/watch?v=dFDgf33gSf -o /run/media/blah/Blah de Blah/ya ya/%(title)s.%(ext)s

@hrisskar Oh, you've got an alias or shell function redefining it.

Tell me what `which youtube-dl` says and I'll tell you how to alter it to handle multiple arguments properly.

@hrisskar Sorry. Force of habit. I'm used to using Markdown code snippet syntax everywhere.

Tell me what "which youtube-dl" (without quotes of any kind) says.

@hrisskar Hmm. Unlike bash, zsh's "which" is a shell builtin, so it'll identify functions and aliases.

That it gave you a path suggests that it's getting converted to "youtube-dl -ciw ..." some other way. (Or I misunderstood you.)

First, try prefixing it with "command" to see if that alters its behaviour (eg. "command youtube-dl youtube.com/watch?v=Xc4xYacTu- youtube.com/watch?v=T2br1fAKOG")

("command" tells a shell like bash or zsh to bypass aliases, functions, builtins, etc. and call the on-disk command)

@hrisskar Oh, correction. Put quotes around that. Right now, I just want to get you to reliable not needing ` && youtube-dl` while I find the name of the shell option I suspect of being the culprit for needing the quotes.

@hrisskar That "no matches found" is the key. You *are* running zsh with one of the globbing options which prevents it from passing un-matched globs through verbatim.

Try running "setopt NO_NOMATCH" and, if that fixes the problem, add it to your ~/.zshrc

If it causes the URL to be omitted from the command, also run "unsetopt NULL_GLOB"

@hrisskar :)

Is it working with multiple URLs in a single youtube-dl command now (no &&) or do we still need to fix that?

@ssokolow Internet's been slow for a while, but looks like we have a success!

@ssokolow And thank you for your help so far! I'm a newbie to (especially the command-line) and I wanna learn moar and moar as I go along. :christmas_parrot:

One thing I wish I knew a few days ago is you could use youtube-dl to not only download ONLY the audio, but ALSO convert to mp3s/oggs/etc in the same command! I had intended to download all the videos from several channels like Cryo Chamber (which are more-or-less only music) and THEN use ffmpeg to convert the saved vids... :gonk:

@hrisskar No problem. I enjoy sharing knowledge.

With youtube-dl, are you referring just to the post-download conversion or were you also aware that some sites (YouTube included) offer separate audio and video streams to their players, so you can download just the audio and avoid having to discard the video before converting to your desired format?

For example:

youtube-dl -f 251 -x --audio-format vorbis youtube.com/watch?v=Pwe-pA6TaZ

("youtube-dl -F THE_URL" will list the formats you can ask for with "youtube-dl -f")

@ssokolow Yep. I... didn't learn about downloading specific formats before downloading hundreds of "videos" like below -- which amount to a still image with background music; I only wanted the music:

invidious.snopyta.org/watch?v=

@hrisskar Not my cup of tea. I'm more into melodic music than rhythmic.

Anyway, I need to prepare for bed but, if you'd like, once I'm up again, I could show you some other interesting zsh stuff I use.

(For example, if you're not already using it, "setopt AUTO_PUSHD" will make "cd" act like "pushd" and build up an undo stack you can rewind with "popd")

@ssokolow Sure, I'd like to get some impromptu zsh lessons! :blobsmilehappyeyes:

>"setopt AUTO_PUSHD" will make "cd" act like "pushd" and build up an undo stack you can rewind with "popd"
I'll have to websearch to find out what "pushd" and "popd" mean. :gentleblob: The more you know because knowledge is power!

@hrisskar @hrisskar "pushd" is basically just a version of "cd" which adds a new entry to the directory stack you can view with the "dirs" command.

If you always use "pushd" (or "cd" with AUTO_PUSHD) to change directories, then "popd" acts like a Back button for directory changes.

@ssokolow Sounds useful for if and when I ever get around to depending less on GUI and be more command-line-ey like a TRVE H4X0R :flower:

@hrisskar *chuckle* If you want to be a TRU3 H4X0R, the first thing to do is get a drop-down terminal emulator like Yakuake, Guake, or Tilda.

kde.org/applications/system/or

guake.org/

troubleshooters.com/linux/tild

@ssokolow I should give one of these a shot to see how I like hotkeying a terminal back and forth instead of keeping a window up (but behind a maximized window) most the time!

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.