Yeah, well for those who'd rather push 2 keys instead of doing it in several
steps every single time,
here's a version of 2 scripts that work for me (though the one for streaming
in particular could be better):
For streaming :
xclip -selection clipboard blank
xclip -i /dev/null # these 2 erase the clipboards. It seems there are 2
clipboards. I don't understand much of it yet
xdotool key ctrl+l # xdotools needs to be installed. This selects the url.
xclip -selection clipboard blank
xclip -i /dev/null
xdotool key ctrl+l
# I've written these 3 commands twice because I noticed I had to launch the
script twice to copy a new url. Barbaric coding, but it works for me. Maybe
you won't need as much if you're on a full install.
vlc $(youtube-dl --prefer-free-formats -g $(xclip -o))
For downloading :
cd ~/
xdotool key ctrl+l # xdotools needs to be installed. This selects the url.
var=$(xclip -o) # You also need xclip installed. this puts the copied url in
a variable before youtube-dl uses it. Else, sometimes it failed without doing
that in my experience.
youtube-dl --prefer-free-formats $var
Since it uses youtube-dl, it covers more ground than say, u
Unplug which is still a good, simple option.