aboutsummaryrefslogtreecommitdiff
path: root/showURLimage.sh
diff options
context:
space:
mode:
Diffstat (limited to 'showURLimage.sh')
-rwxr-xr-xshowURLimage.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/showURLimage.sh b/showURLimage.sh
index 2d5b485..cd7db1f 100755
--- a/showURLimage.sh
+++ b/showURLimage.sh
@@ -1,7 +1,14 @@
#!/bin/sh
# Downloads an url to /tmp and opens it with sxiv.
+# If the url is from youtube tries to download the thumbnail.
+
+url="$1"
+echo "$url" | grep -i "youtube" >/dev/null &&
+ url="$(youtube-dl --get-thumbnail "$url")"
filename="/tmp/showURLimage$(date +%H%M%S)"
-curl "$1" > "$filename"
-sxiv -b -N "sxivfloat" "$filename" || notify-send "No image found at $1"
+
+curl "$url" > "$filename"
+sxiv -b -N "sxivfloat" "$filename" || notify-send "No image found at $url"
+