Guest User

thumb-archive.sh

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