Created
June 9, 2024 17:08
-
-
Save wolandark/92ba2784b94a5e6ba2c8ec7464dbec4c to your computer and use it in GitHub Desktop.
grabs the latest xkcd comic and displays it with sixel graphics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# xkcdsh | |
# info: | |
# grabs the latest xkcd comic and displays it with sixel graphics | |
# Written By Wolandark | |
# https://www.github.com/wolandark | |
# Dependency: | |
# libsixel | |
# curl | |
# GNU sed | |
# GNU Grep | |
curl -s https://xkcd.com | grep -oP '(?<=<img src="//imgs.xkcd.com/comics/)[^"]*' | \ | |
sed 's/^/https:\/\/imgs.xkcd.com\/comics\//' | \ | |
while read -r url; do | |
filename=$(basename "$url") | |
curl -so "$filename" "$url" && img2sixel "$filename" | |
printf '%s\n' "$filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment