|
- #!/usr/bin/env sh
-
- # Download PDF files for a planning application from Sutton Council planning website
- # If you run this more than once it'll only download the new files uploaded for that application.
- # Usage: $ get.sh <application number>, e.g. $ get.sh B2015/71962
- # Install curl and wget before use. Mac users can install them with Homebrew.
- # Windows users: Try running this in Cygwin or install Linux in a virtual machine.
- # Adrian Short 26 Feb 2016
-
- COOKIEJAR=cookiejar.txt
- BASEURL=https://fastweb.sutton.gov.uk/fastweb
-
- mkdir -p $1
- cd $1
-
- curl -s -c $COOKIEJAR "$BASEURL/welcome.asp" > /dev/null # Get the session cookies
-
- curl -s -c $COOKIEJAR \
- --data "cbxCopyrightStatement=on" \
- --data "ApplicationNumber=$1" \
- "$BASEURL/images.asp" \
- | grep -E -o 'http.+?\.(pdf|PDF)' \
- | wget --no-check-certificate --no-clobber -i -
-
- rm $COOKIEJAR
- ls -lht
- cd -
|