nyt 595 B

1234567891011121314151617
  1. #!/bin/bash
  2. BASEDIR="/var/photos/misc/nytimes"
  3. DATE=$(date +"%Y-%m-%d")
  4. TMPFILE=/tmp/nyt.pdf
  5. OUTFILE=$BASEDIR/$DATE.jpg
  6. if test -f "$OUTFILE"; then
  7. echo "NYT front page already found. Not downloading."
  8. else
  9. DATEPATH=$(date +"%Y/%m/%d")
  10. curl -o /tmp/nyt.pdf -L https://static01.nyt.com/images/$DATEPATH/nytfrontpage/scan.pdf
  11. convert -density 150 -quality 75 $TMPFILE $OUTFILE
  12. ln -sf $OUTFILE /var/lib/weewx/www/today.jpg
  13. ln -sf $OUTFILE $BASEDIR/today.jpg
  14. curl -H "X-Title: NYT headlines today" -d "https://files.lab.unbl.ink/nytimes/today.jpg" https://ntfy.unbl.ink/news
  15. rm $TMPFILE
  16. fi