To address your specific question about xargs
, you need to specify that you want to use the {}
placeholder:
youtube-dl --get-title "Youtube URI" |\
xargs -I{} youtube-dl -o {} "Youtube URI"
See man xargs
for more info, and what switches are also implied by -I
.
Since it's only a single argument, it would be more straightforward to use substitution:
youtube-dl -o "$(youtube-dl --get-title "Youtube URI")" "Youtube URI"
Note that these constructions will give you a file without appropriate file extension.
The most straightforward way to accomplish your actual task would as mentioned be to use the built-in title naming option:
youtube-dl -t "Youtube URI"
as described in man youtube-dl
. This will also produce the correct file extension for the video file.
-0
would produce a file name with the ending newline character in it, which is allowed, but often annoying. If no other delimiter is given with-d
,xargs
defaults to\n
("newline") which is appropriate in this case.