diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-12-12 00:12:10 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-12-12 00:12:10 +0100 |
commit | e04eb710bbd01c0f6f486c037815687081c21d4b (patch) | |
tree | 9b86cd1aa3921c7a706944bf04922c817e2180dc /bin/common/ytlink | |
parent | 94c9b362faa414e7068f60184e3d01a47b96b823 (diff) |
added ytlink
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" |