3 ms·
I have this in my shellrc, so that `youtube-dl` without arguments takes the URL from the clipboard: youtube-dl() { if [ $# -eq 0 ]; then if [ "${WA
by majewsky 6y ago
I have this in my shellrc, so that `youtube-dl` without arguments takes the URL from the clipboard:
youtube-dl() {
if [ $# -eq 0 ]; then
if [ "${WAYLAND_DISPLAY}" != "" ]; then
env youtube-dl -f best "$(wl-paste --type text/plain)"
else
env youtube-dl -f best "$(xsel -b)"
fi
else
env youtube-dl "$@"
fi
}
(Replace "-f best" if you just want audio.)
- Liskni_si 6y agoI took this "shell wrapper around youtube-dl" thing a bit further: I have a script that uses youtube-dl to download and enqueue music to mpd. I mainly use it to listen to bandcamp albums that I don't know yet so I can decide whether to buy them or stop listening to them. The script also automatically deletes stuff after a while so I don't accidentally keep listening to albums I haven't bought. Source here if anyone's interested: https://github.com/liskin/dotfiles/blob/home/bin/youtube-dl-mpd https://github.com/liskin/dotfiles/blob/home/bin/youtube-dl-...