I have the CLI utility "youtube-dl" installed. It takes a urls as arguments. It is most natural to paste these urls from the system clipboard. Using zsh, however, this returns an error "no matches found" because the special characters in youtube urls are not escaped.
I need to go from this:
https://www.youtube.com/watch?v=ShxHGFs2IKE
to this:
https\:\/\/www\.youtube\.com\/watch\?v=ShxHGFs2IKE
It is quite a pain to manually escape all the characters every time, so my question is: how can I make this work without all the manual editing of urls each time?
As said in the comments, try using quotes:
youtube-dl 'https://www.youtube.com/watch?v=ShxHGFs2IKE'
Or you can load zsh
url-quote-magic to get special shell characters to be quoted automatically in URLs:
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With