summaryrefslogtreecommitdiff
path: root/bin/common/ytclipo
diff options
context:
space:
mode:
Diffstat (limited to 'bin/common/ytclipo')
-rwxr-xr-xbin/common/ytclipo19
1 files changed, 1 insertions, 18 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo
index 959ee21..1a82df2 100755
--- a/bin/common/ytclipo
+++ b/bin/common/ytclipo
@@ -1,23 +1,6 @@
#!/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)"
-
-# remove util scheme
-inp="${inp#*//}"
-# convert to youtube.com/path url
-# works for:
-# - 'youtu.be/watch?v=xxxxxx'
-# - 'https://piped.video/watch?v=xxxxx'
-inp="https://youtube.com/${inp#*/}"
+inp="$(ytlink)"
>&2 printf "inp: %s\n" "$inp"
notify-send "ytclipo" "downloading <i>$inp</i>" || :