diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-11-16 21:56:12 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-11-16 21:56:12 +0100 |
commit | 1dcdf0cdb769296c33737d285ba9008cff0d60ba (patch) | |
tree | ac0ecd986284f5ae73b413143739281b9f8577bd /bin | |
parent | 6b06b850ff9e7d0e5972c6f9bd592043fe5867f8 (diff) |
improved compatibility for different frontends
Introduces the use of parameter expansion for converting the link,
also convert to youtube.com, because this fixes the bug where you
couldn't download playlists/channels.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/common/ytclipo | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/common/ytclipo b/bin/common/ytclipo index 8997539..959ee21 100755 --- a/bin/common/ytclipo +++ b/bin/common/ytclipo @@ -11,9 +11,13 @@ fi inp="$1" [ "${inp:=$(paste)}" ] || inp="$(cat /dev/stdin)" -# take last link from clipboard -# works when link is from yt-local -inp="https://youtu.be/$(echo "$inp" | sed 's/.*\(.\{11\}\)$/\1/')" +# 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#*/}" >&2 printf "inp: %s\n" "$inp" notify-send "ytclipo" "downloading <i>$inp</i>" || : |