summaryrefslogtreecommitdiff
path: root/bin/common/ytclipo
blob: ee5bf0fb59d00dfd14d650c796e65c1fd4b8a87a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

# argument ($1) -> clipboard -> stdin
test -z "${inp:=${1:-"$(xclip -sel c -o)"}}" \
	&& inp="$(cat /dev/stdin)"

echo "inp: ${inp}" 1>&2
# take last link from clipboard
# works when link is from yt-local
inp="$(echo -n "$inp" | awk -F 'https?://' '{print $NF}')"
echo "inp: ${inp}" 1>&2

yt-dlp "$inp" \
	-f "b" \
	-S "res:720" \
	-P "$HOME/vids" \
	-o "%(title)s.%(ext)s"