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/lh13
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/lh b/bin/lh
index 40d747d..331b358 100755
--- a/bin/lh
+++ b/bin/lh
@@ -2,6 +2,12 @@
 # lh: the Link Handler
 # takes one path or URL as its argument, launches the appropriate program for it
 
+# set argument 1 to stdin if there are no args
+if [ $# -eq 0 ]
+then
+	set -- "$(cat)"
+fi
+
 # if $1 isn't provided, spawn $BROWSER and exit. this allows lh to be used as a pseudo-browser.
 [ -z "$1" ] && exec "$BROWSER"
 #from pure-sh-bible
@@ -43,6 +49,9 @@ findredir() {
 	done
 }
 
+# while loop for multiple urls
+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:]')
 
@@ -54,7 +63,7 @@ case "$URL" in
 		$TERMINAL -e bombadillo "$URL" ;;
 	*.mkv*|*.webm*|*.mp4*)
 		mpv --no-terminal "$URL" & ;;
-	*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*)
+	*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" & ;;
 	*twitch.tv/*)
 		STREAMQUAL="$(split "$(streamlink "$URL"|grep 'Available streams')" ", "|\
@@ -80,3 +89,5 @@ case "$URL" in
 			$BROWSER "$URL" >/dev/null 2>&1 &
 		fi ;;
 esac
+shift
+done