Hi-
I'm trying to put together a quick script for YouTube-dl. I've seen scripts for this by others on the forum, but I'm just trying to do one with the specific options I like. I've hit a snag trying to "escape" one of my command line options. The command I'm trying to execute is the following (followed by the URL):
youtube-dl -f ("bestvideo[width>=1920]"/bestvideo)+bestaudio/best -ciw -o "%(uploader)s-%(title)s-%(upload_date)s-%(id)s.%(ext)s" -v
The issue seems to be the ">=". What is the appropriate way to escape this? I've read a number of posts regarding multiple """, but so far no luck with this particular pattern. No matter what I've tried it appears to be parsed into two commands at the ">=".
Thanks for any sage advice from the scripting mystics!
Escape "=>" in a script.
Re: Escape "=>" in a script.
By doubling them
Or a heredoc syntax would work as well
Code: Select all
run """youtube_dl"" -f (""bestvideo[width>=1920]""/bestvideo)+bestaudio/best -ciw -o ""%(uploader)s-%(title)s-%(upload_date)s-%(id)s.%(ext)s"" -v https://www.youtube.com/watch?v=PTYPPnKGPPE", %TEMP%, 2, 1;
Code: Select all
$cmd = <<<>>>
"youtube-dl" -f ("bestvideo[width>=1920]"/bestvideo)+bestaudio/best -ciw -o "%(uploader)s-%(title)s-%(upload_date)s-%(id)s.%(ext)s" -v https://www.youtube.com/watch?v=PTYPPnKGPPE
>>>;
run $cmd, %TEMP%, 2, 1;
One of my scripts helped you out? Please donate via Paypal
Re: Escape "=>" in a script.
Thanks for the speedy reply highend!
Looks like I was close, but the straightforwardness of it threw me. :-)
Thanks for the heredoc tip also- I'll investigate that for future needs.
Looks like I was close, but the straightforwardness of it threw me. :-)
Thanks for the heredoc tip also- I'll investigate that for future needs.