not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

get.sh 871 B

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