summaryrefslogtreecommitdiff
path: root/bin/common/ytclipo
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-03-09 22:52:50 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-03-09 22:52:50 +0100
commit8d73085ec9575fb00b14956be8ae66081e98e714 (patch)
treee828b69c37d3407b3c5e1331c8cc973dad7a813a /bin/common/ytclipo
parente99503212cdc28226ee99e9488de5cd5500f46cb (diff)
changed ytclipo alias to a script
Diffstat (limited to 'bin/common/ytclipo')
-rwxr-xr-xbin/common/ytclipo17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo
new file mode 100755
index 0000000..ee5bf0f
--- /dev/null
+++ b/bin/common/ytclipo
@@ -0,0 +1,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"