#!/bin/bash #Bisnis Indonesia ePaper downloader #by: Ardianto Satriawan #ditambahkan oleh Andrian Dion P. #need gs and pdftk #sudo apt-get install gs pdftk if `dpkg -l | awk {'print $2'} | grep -q wget`; then $(exit 0) else sudo apt-get install wget fi ###checking imagemagick package if `dpkg -l | awk {'print $2'} | grep -q imagemagick`; then $(exit 0) else sudo apt-get install imagemagick fi if `dpkg -l | awk {'print $2'} | grep -q imagemagick`; then $(exit 0) else sudo apt-get install imagemagick fi ###checking gs package if `dpkg -l | awk {'print $2'} | grep -q gs`; then $(exit 0) else sudo apt-get install gs fi ###checking pdftk package if `dpkg -l | awk {'print $2'} | grep -q pdftk`; then $(exit 0) else sudo apt-get install pdftk fi #get today's date TODAYFOLDER=$(date +%Y/%m/%d) TODAYFILE=$(date +%d_%m_%Y) TODAY=$(date +%d-%b-%Y) #get each page PAGE=1 until [ $PAGE -gt 9 ]; do wget "http://epaper.bisnis.com/PUBLICATIONS//BisnisIndonesia/BI/"$TODAYFOLDER"/PagePrint/"$TODAYFILE"_00"$PAGE".pdf" let PAGE+=1 done PAGE=10 until [ $PAGE -gt 28 ]; do wget "http://epaper.bisnis.com/PUBLICATIONS/BISNISINDONESIA/BI/"$TODAYFOLDER"/PagePrint/"$TODAYFILE"_0"$PAGE".pdf" let PAGE=PAGE+1 done PAGE=101 until [ $PAGE -gt 108 ]; do wget "http://epaper.bisnis.com/PUBLICATIONS/BISNISINDONESIA/BI/"$TODAYFOLDER"/PagePrint/"$TODAYFILE"_"$PAGE".pdf" let PAGE+=1 done PAGE=141 until [ $PAGE -gt 148 ]; do wget "http://epaper.bisnis.com/PUBLICATIONS/BISNISINDONESIA/BI/"$TODAYFOLDER"/PagePrint/"$TODAYFILE"_"$PAGE".pdf" let PAGE+=1 done #move to today's directory mv ./*.pdf ./$TODAY #merge the PDFs gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=./$TODAY/BisnisIndonesia-$TODAY.pdf -dBATCH ./$TODAY/*.pdf #remove PDFs rm ./$TODAY/$TODAYFILE*.pdf