#!/bin/sh

COMPRESS="bzip -Q"

   # EST is 5 hours west of UTC (-u), and nytimes.com is EST
read       today1  today2  today3  date <<done
   `date +"%m%d    %b%d%y  %y%m%d  %d"  -u -d "$* -5 hours"`
done

sections="(\
front|\
library.*$today1|\
news/world|\
news/national|\
news/washpol|\
day/cyber|\
news/financial|\
news/sports|\
news/arts|\
artleisure/$date\
)"
save="www.nytimes.com/yr www.nytimes.com/library"
   # the header is the basic-auth printable-encoded version of "name:passwd"
passwd='Authorization:Basic Y3NpbHZlcnM6aWhhdGVwdw=='

rm -r $save                                           # get rid of old pages

echo Getting NYTimes for $today1
fetch.pl -h"$passwd" -d2 -r".*/$sections.*\.html" www.nytimes.com/yr/mo/day/news/
# fetch.pl -h"$passwd" www.nytimes.com/partners/xword/$today2.puz

tar cf - $save | $COMPRESS > nytimes.$today3.tar.bz   # back up new pages
