Skip to content

Instantly share code, notes, and snippets.

@Raymo111
Created October 25, 2019 02:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raymo111/40d97b86a4e70edb777ae85fe925899a to your computer and use it in GitHub Desktop.
Save Raymo111/40d97b86a4e70edb777ae85fe925899a to your computer and use it in GitHub Desktop.
Dilbert Crawl
#!/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