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.)