A Ruby gem to get planning applications data from UK council websites.
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.
 
 
 

24 lines
752 B

  1. require "uk_planning_scraper/version"
  2. require 'uk_planning_scraper/idox'
  3. require 'uk_planning_scraper/northgate'
  4. require 'logger'
  5. module UKPlanningScraper
  6. def self.search(search_url, params, options = {})
  7. default_options = {
  8. delay: 10,
  9. }
  10. options = default_options.merge(options) # The user-supplied options override the defaults
  11. # Select which scraper to use based on the URL
  12. if search_url.match(/search\.do\?action=advanced/i)
  13. return self.scrape_idox(search_url, params, options)
  14. elsif search_url.match(/generalsearch\.aspx/i)
  15. return self.scrape_northgate(search_url, params, options)
  16. else
  17. # Not supported
  18. raise "Planning system not supported for URL: #{search_url}"
  19. end
  20. end
  21. end