about summary refs log tree commit diff stats
path: root/bin/lh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/lh')
-rwxr-xr-xbin/lh19
1 files changed, 10 insertions, 9 deletions
diff --git a/bin/lh b/bin/lh
index 71bc747..07be403 100755
--- a/bin/lh
+++ b/bin/lh
@@ -53,27 +53,28 @@ findredir() {
 while [ $# -ne 0 ]
 do
 # handle redirects. tr removes control characters, so the case statement below works as expected.
-URL=$(echo "$1"|findredir|tail -1|tr -d '[:cntrl:]')
+URL="$(echo "$1"|findredir|tail -1|tr -d '[:cntrl:]')"
 
 # if there were no redirects, just set URL to the first argument
 [ -z "$URL" ] && URL="$1"
 
 case "$URL" in
 	gemini://*|gopher://*)
-		$TERMINAL -e bombadillo "$URL" ;;
+		"$TERMINAL" -e bombadillo "$URL" ;;
 	*.mov*|*.mkv*|*.webm*|*.mp4*)
 		mpv --no-terminal "$URL" & ;;
-	*invidio.us/watch*|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*)
-		mpv --no-terminal --ytdl "$URL" & ;;
+	*invidio.us/watch*|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*|*clips.twitch.tv*|*streamable.com*)
+		yw "$URL" & ;;
 	*twitch.tv/*)
 		STREAMQUAL="$(split "$(streamlink "$URL"|grep 'Available streams')" ", "|\
 			grep -E "[0-9]"|\
 			dmenu -p "choose stream quality for $URL")"
-		streamlink -p mpv $URL $STREAMQUAL >/dev/null 2>&1 & ;;
-	*.png*|*.jpg*|*.jpe*|*.jpeg*|*.gif*)
+		streamlink -p mpv "$URL" "$STREAMQUAL" >/dev/null 2>&1 & ;;
+	*.png*|*.jp[eg]*|*.gif*)
 		IMGPATH="/tmp/$(lstrip "$URL" "*/")"
-		curl -sL "$URL" >"$IMGPATH"&&sxiv -pqa "$IMGPATH" & ;;
-	*.mp3*|*.m4a*|*.flac*|*.aiff*|*.opus*|*.ogg*|*.mp3?source*|*.wav*)
+		curl -sL "$URL" > "$IMGPATH" &&
+		sxiv -pqa "$IMGPATH" & ;;
+	*.mp3*|*.m4a*|*.flac*|*.aiff*|*.opus*|*.ogg*|*.wav*)
 		$TERMINAL -e mpv "$URL"& ;;
 	*.epub*|*.pdf*|*.djvu*)
 		BOOKPATH="/tmp/$(lstrip "$URL" "*/")"
@@ -86,7 +87,7 @@ case "$URL" in
 		if [ -f "$URL" ]; then
 			op "$URL"
 		else
-			$BROWSER "$URL" >/dev/null 2>&1 &
+			"$BROWSER" "$URL" >/dev/null 2>&1 &
 		fi ;;
 esac
 shift