Fork me on GitHub

news-to-pdf

Description: Download the epaper from the kantipur.com

#!/bin/bash
echo "Checking Date with your system.. Please wait!"
#checking the date with the system
y=$(date +%Y)
#prints the year in full format. Eg: 2017
m=$(date +%m)
#prints the month. Eg: 04
d=$(date +%d)
#prints the day. Eg: 12
w=$(date +%u)
#prints the week day. Eg: 3=wednesday

#using wget
#downloading the kantipur[daily-nepali]
#checking the date with the system

echo "Folder may exist. It will automatically enter into the directory if present!"
cd ~ && mkdir Kantipur && cd kantipur
echo "Downloading Kantipur Dainik for today.. Please wait!"
wget -O kantipur-$y-$m-$d.pdf "http://epaper.ekantipur.com/epaper/kantipur/$y-$m-$d/$y-$m-$d.pdf"
echo "Successfully downloaded Kantipur for today!"

#downloading the kathmandu post[daily-english]
echo "Downloading The Kathmandu Post for today.. Please wait!"
wget -O thekathmandupost-$y-$m-$d.pdf "http://epaper.ekantipur.com/epaper/the-kathmandu-post/$y-$m-$d/$y-$m-$d.pdf"
echo "Successfully downloaded The Kathmandu Post for today!"

#Saptahik is released every friday!
#checking the system date to match if it is friday
#monday=1
if [ $w == 5 ]
then
echo "Downloading Saptahik for this weekend.. Please wait!"
wget -O saptahik-$y-$m-$d.pdf "http://epaper.ekantipur.com/epaper/saptahik/$y-$m-$d/$y-$m-$d.pdf"
echo "Successfully downloaded Saptahik for this week!"
else
echo "Saptahik isn't available for today! Wait till Friday!"
fi

#Nepal magazine is released every Sunday
#checking the system date to match if it is Sunday
#monday=1
if [ $w == 7 ]
then
echo "Downloading Nepal for this weekend.. Please wait!"
wget -O nepal-$y-$m-$d.pdf "http://epaper.ekantipur.com/epaper/nepal/$y-$m-$d/$y-$m-$d.pdf"
echo "Successfully downloaded Nepal for this weekend!"
else
echo "Nepal magazine isn't available for today! Wait till Sunday!"
fi


Download the Script here.