Created
October 25, 2019 02:30
-
-
Save Raymo111/40d97b86a4e70edb777ae85fe925899a to your computer and use it in GitHub Desktop.
Dilbert Crawl
This file contains 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
#!/bin/bash | |
start=$1 | |
case "$2" in | |
"") end=$1 ;; | |
*) end=$2 ;; | |
esac | |
start=$(date -d $start '+%Y-%m-%d') | |
end=$(date -d $end '+%Y-%m-%d') | |
[ -d Dilberts ] || mkdir Dilberts | |
cd Dilberts | |
while [[ $(date -d $start +%s) -le $(date -d $end +%s) ]] | |
do | |
img=$(curl -s https://dilbert.com/strip/$start | grep "img-responsive img-comic") | |
img=${img#*src=\"} | |
img=${img%\"*} | |
img=https:$img | |
echo "$start: $img" | |
wget -qct=2 --retry-connrefused -O $start $img | |
start=$(date -d "$start + 1 day" '+%Y-%m-%d') | |
done | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment