#!/bin/sh # argument ($1) -> clipboard -> stdin if [ "$WAYLAND_DISPLAY" ] then paste="$(wl-paste)" else paste="$(xclip -o -sel c)" fi test -z "${inp:=${1:-$paste}}" && inp="$(cat /dev/stdin)" # take last link from clipboard # works when link is from yt-local inp="https://youtu.be/$(echo "$inp" | sed 's/.*\(.\{11\}\)$/\1/')" echo "inp: ${inp}" 1>&2 notify-send "ytclipo" "downloading $inp" yt-dlp "$inp" \ --restrict-filenames \ -f "b" \ -S "res:720" \ -P "$HOME/vids/youtube/" \ -o "%(title)s.%(ext)s" notify-send "ytclipo" "ytclipo
finished downloading." echo "$inp" >> /tmp/ytclipo_history