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.

37 lines
1.1 KiB

  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. URLS=urls.txt
  10. BASEURL=https://fastweb.sutton.gov.uk/FASTWEB
  11. mkdir -p $1
  12. cd $1
  13. echo "Getting session cookies"
  14. curl -s -c $COOKIEJAR "$BASEURL/welcome.asp" > /dev/null # Get the session cookies
  15. echo "OK"
  16. echo
  17. echo "Getting list of PDF files. This could take several minutes if there are a large number of documents for this application."
  18. curl -s -c $COOKIEJAR \
  19. --data "cbxCopyrightStatement=on" \
  20. --data "ApplicationNumber=$1" \
  21. "$BASEURL/images.asp" \
  22. | grep -E -o 'http.+?\.(pdf|PDF)' > $URLS
  23. echo "OK"
  24. echo "Downloading PDFs"
  25. wget --no-check-certificate --no-clobber -i $URLS
  26. echo "Downloading complete"
  27. rm $COOKIEJAR
  28. ls -lht
  29. cd -