#!/bin/bash
#change the path to suit your needs
PWD=/var/www/html/home.paulwillard.nz
# OPTIONS="--quiet"
OPTIONS=""

# add in to CRON to auto update in the background
#          */15    *   * * *   www-data    /var/www/html/home.paulwillard.nz/wget_rss_feeds.sh

wget $OPTIONS -O $PWD/nzherald.xml http://rss.nzherald.co.nz/rss/xml/nzhtsrsscid_000000698.xml
# wget $OPTIONS -O $PWD/stuff.xml https://www.stuff.co.nz/rss/
curl $OPTIONS -o $PWD/stuff.xml https://www.stuff.co.nz/rss/
wget $OPTIONS -O $PWD/theregister.xml http://www.theregister.co.uk/headlines.rss
wget $OPTIONS -O $PWD/wordpress.xml http://wordpress.org/news/feed/
wget $OPTIONS -O $PWD/mub.xml https://mandrivausers.org/index.php?/discover/all.xml/
# wget --quiet -O $PWD/mcrides.xml https://www.mcrides.co.nz/latest.rss
# wget --quiet -O $PWD/mcrides_comments.xml https://www.mcrides.co.nz/posts.rss
wget $OPTIONS -O $PWD/kiwibiker.xml http://www.kiwibiker.co.nz/forums/external.php?type=RSS2
wget $OPTIONS -O $PWD/svportal.xml http://www.sv-portal.com/forums/external.php?type=RSS2
wget $OPTIONS -O $PWD/computerworld.xml https://www.computerworld.co.nz/rss/location/australia/
wget $OPTIONS -O $PWD/google_local.xml "https://news.google.com/news/rss/?ned=nz&hl=en-NZ"
wget $OPTIONS -O $PWD/rnz_national.xml "http://www.radionz.co.nz/rss/national.xml"
wget $OPTIONS -O $PWD/techrepublic.xml "https://www.techrepublic.com/rssfeeds/articles/?feedType=rssfeeds&sort=latest"
wget $OPTIONS -O $PWD/pcworld.xml https://www.pcworld.com/feed
# wget --quiet --header="accept-encoding: gzip" -O $PWD/pcworld.xml.gz https://www.pcworld.com/feed
# gunzip -f $PWD/pcworld.xml.gz
wget $OPTIONS -O $PWD/greatwall.nz.atom https://www.greatwall.nz/feed
wget $OPTIONS -O $PWD/dev.to.xml https://dev.to/feed

# use xsltproc and atom2rss.xsl to convert Atom to RSS
# wget --quiet -O $PWD/dynaclub.atom https://www.dynaclub.nz/app.php/feed
/usr/bin/xsltproc $PWD/atom2rss.xsl $PWD/greatwall.nz.atom > $PWD/greatwall.nz.xml 2> /dev/null


/usr/bin/php $PWD/index.php > /dev/null 2>&1
