diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-12-12 09:22:22 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-12-12 09:22:22 +0100 |
commit | ffc2a7d3cee6385508601374bdd34db253b70c65 (patch) | |
tree | 433bda0daa8504538ce27bdc7a80999bba611663 /bin/common/ytlink | |
parent | f4dc6e9489bd1274cba77aec04343dbec72f4a7d (diff) | |
parent | 6b44e39caba17672bf32960f5829597d9fa544b1 (diff) |
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'bin/common/ytlink')
-rwxr-xr-x | bin/common/ytlink | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/common/ytlink b/bin/common/ytlink new file mode 100755 index 0000000..a5e9bf0 --- /dev/null +++ b/bin/common/ytlink @@ -0,0 +1,14 @@ +#!/bin/sh + +# convert to youtube.com/path url +# works for: +# - 'youtu.be/watch?v=xxxxxx' +# - 'https://piped.video/watch?v=xxxxx' + +inp="$1" +[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" + +# remove util scheme +inp="${inp#*//}" +inp="https://youtube.com/${inp#*/}" +printf "%s" "$inp" |