7

OK so I am just getting started with the command line stuff so I am guessing this is really a very noob question:

I downloaded the youtube-dl according to this post https://ytdl-org.github.io/youtube-dl/download.html and tried to download a youtube video with this command:

youtube-dl --verbose https://www.youtube.com/watch?v=52bRYf198XY

but it returned

zsh: no matches found: https://www.youtube.com/watch?v=52bRYf198XY

I am on Macbook pro mid-2014 Catalina if it is any help.

2 Answers 2

14

? appears in the address. Shells use ? as a wildcard for exactly one character in filename generation.

In case there is no matching file in the current working directory, many shells would treat ? literally; your command, although not entirely robust, would probably work in such shell. But not in Zsh, it complains there in no match.

A match could be e.g. https:/www.youtube.com/watchXv=52bRYf198XY (where https: and www.youtube.com are directories; and // became /). If you happened to have an existing file with this path, your command would pass the wrong address to the tool. If there were many matches, it would pass many arguments. This behavior is obviously not what you want. Filename generation makes no sense here.

Single-quote the address to make the shell pass it to the tool verbatim:

youtube-dl --verbose 'https://www.youtube.com/watch?v=52bRYf198XY'
3
  • When I still had an error, use of double quotes "example" instead of single quotes 'example' resolved my issue.
    – kando
    Commented Jun 16, 2023 at 18:27
  • @kando In what shell? Commented Jun 16, 2023 at 18:28
  • zsh. Maybe that's common knowledge? I'm not a very "super" user.
    – kando
    Commented Jun 16, 2023 at 18:41
2

I can confirm the above solution Kamil Maciorowski posted also works with yt-dlp - the youtube-dl fork that is more up-to-date, at least currently.

yt-dlp -f "best[height>=720]" '<your_youtube_URL_in_single_quotes_for_ZSH>' -o '%(id)s.%(ext)s'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .