Posts

Showing posts from December, 2017

NatGeo - Download a month's photos

NG_download_month.sh #!/bin/sh CYAN='\033[0;36m' YELLOW='\033[1;33m' NC='\033[0m' # No Color currentPath=`pwd` currentYear=`date +"%Y"` currentMonth=`date +"%m"` downloadYear=$1 downloadMonth=$2 force=$3 if [ $# -lt 2 ] then echo "YEAR and MONTH arguments required; eg: ./NG_download_month.sh 2017 06" exit fi jsonFilename="gallery."$downloadYear"-"$downloadMonth".json" if [ $currentYear -eq $downloadYear -a $currentMonth -eq $downloadMonth ] then echo "${CYAN}Current month${NC} images get update. Deleting file: $jsonFilename" rm $jsonFilename elif [ $force == '-f' ] then echo "Force deleting file: $jsonFilename" rm $jsonFilename fi if [ ! -f $jsonFilename ] then echo "${YELLOW}$jsonFilename${NC} unavailable. Downloading..." # BASE_URL="http://www.nationalgeographic.com/photography/photo-of-the-day/_jcr_content" BASE_URL="https://www.