blob: 861e8f7bc723c5cd526079ba75abf1e5916474b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
# Downloads an url to /tmp and opens it with sxiv.
# If the url is from youtube tries to download the thumbnail.
folder="/tmp/showURLimage"
filename="${folder}/$(date +%H%M%S)"
url="$1"
[ -d "$folder" ] || mkdir -p "$folder"
if echo "$url" | grep -iq "youtube"; then
yt-dlp --skip-download --write-thumbnail --no-playlist -o "$filename" "$url"
convert "${filename}*" "${filename}.jpg"
filename="${filename}.jpg"
else
curl "$url" > "$filename"
fi
sxiv -b -N "sxivfloat" "$filename" || notify-send "No image found at $url"
|