Created
October 1, 2014 02:29
-
-
Save rinx/eb67a39f863b556f8525 to your computer and use it in GitHub Desktop.
Download weather chart data from tenki.jp
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
#!/bin/sh | |
# | |
# Download weather chart data from tenki.jp | |
# | |
CMDNAME=`basename $0` | |
year=$1 | |
month=$2 | |
day=$3 | |
time=$4 | |
if [ $# -ne 4 ]; then | |
cat << EOF 1>&2 | |
Usage: $CMDNAME year month day time | |
Example: $CMDNAME 2014 08 04 12 | |
--> To get 2014/08/04 12:00:00 image. | |
Download weather chart data from tenki.jp | |
Example of download URI | |
http://az416740.vo.msecnd.net/static-images/archive/chart/entries/2014/10/01/2014-10-01-06-00-00-large.jpg | |
EOF | |
exit 1 | |
fi | |
chart_uri="http://az416740.vo.msecnd.net/static-images/archive/chart/entries/$year/$month/$day/${year}-${month}-${day}-${time}-00-00-large.jpg" | |
wget -N "$chart_uri" -O ${year}${month}${day}_${time}_chart.jpg > /dev/null 2>&1 | |
if [ $? -eq 0 ]; then | |
echo -e "\033[0;32m✔ \033[1;35m${year}${month}${day}_${time}_chart.jpg downloaded\033[00m" | sed "s/^-e //" | |
else | |
echo -e "\033[0;31m✗ \033[1;31m${year}${month}${day}_${time}_chart.jpg downloading failed\033[00m" | sed "s/^-e //" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment