Today there was a training meeting where we discussed the proper use of the ward websites. I being the restless person that I am decided to figure out how to automate exporting the calendar. It took about an hour.
Here's how I did it. wget is a wonderful tool. It's good for downloading web pages.
wget --keep-session-cookies --save-cookies cookies.txt\
wget --load-cookies cookies.txt\
You find the loginForm target path by looking at the source of https://secure.lds.org/units/
You find the path to the calendar by observing the calendar link target.
The monthIndex and currentYear variable are required. You will end up with an error page if you don't supply them.
I generate their values using the date command:
MONTH=`/bin/date +%m|sed -e s/0//g`;
The sed command is meant to strip the leading 0 off of the month number.
The final thing I do is
grep `date +%m/%d/%y` calendar.csv
This returns the list of records for the current date. This is going to allow me to generate an RSS feed so that I can see each activity on the day when it comes up.
I just won't be able to tell you where the feed is. I have to keep it to myself because this data doesn't have easy public exports (like RSS feeds and ical subscriptions) for confidentiality reasons.
However, this does not diminish the coolness of the hack.
I can supply the shell script (passwords removed) to anyone interested in downloading their calendars in an automated way.