Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- NOCACHE="$(date +%s)"
- URL="https://site.weathernews.jp/site/live/json/list.json"
- THUMB=$(curl -s "${URL}?nocache=$NOCACHE" | jq -r -c '.live.thumbnail')
- DIR="$(date +"%Y/%m")"
- mkdir -p "$DIR/th"
- thumb_filename=`echo $THUMB | perl -pe 's{http.*thumb/\w\w/}{}; s/(.*).jpg\?nocache=%22(\d+)%22/$2.$1.jpg/'`
- [ -e "$DIR/th/$thumb_filename" ] || curl -s "$THUMB" -o "$DIR/th/$thumb_filename"
Advertisement
Add Comment
Please, Sign In to add comment