blob: 567e3575abd1f9a097487e8b1aa0fa96370b45f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh
# argument ($1) -> clipboard -> stdin
if [ "$WAYLAND_DISPLAY" ]
then paste() { wl-paste; }
elif [ "$TERMUX_VERSION" ]
then paste() { termux-clipboard-get; }
else paste() { xclip -o -sel c; }
fi
inp=”$1”
[ "${inp:=$(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/')"
>&2 printf "inp: %s\n" "$inp"
notify-send "ytclipo" "<b>downloading</b> $inp" || :
yt-dlp "$inp" \
--restrict-filenames \
--embed-chapters \
-f "b" \
-S "res:1080" \
-P "$HOME/vids/youtube/" \
-o "%(channel)s - %(title)s.%(ext)s"
notify-send "ytclipo" "<b>ytclipo</b><br>finished downloading." || :
|