Scrapes planning applications data for InLinkUK from BT kiosks.
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.

21 lines
690 B

  1. require 'uk_planning_scraper'
  2. require 'scraperwiki'
  3. auths = UKPlanningScraper::Authority.all
  4. auths.each_with_index do |auth, i|
  5. next if auth.name == 'Islington' # Temporarily down, causing scraper to hang
  6. puts "#{i + 1} of #{auths.size}: #{auth.name}"
  7. begin
  8. apps = auth.scrape({ validated_days: ENV['MORPH_DAYS'].to_i, keywords: 'inlink'})
  9. apps.each do |app|
  10. unless app[:description].match(/chainlink/i) # Backend keyword search is weak
  11. ScraperWiki.save_sqlite([:authority_name, :council_reference], app, 'applications')
  12. end
  13. end
  14. puts "#{auth.name}: #{apps.size} application(s) saved."
  15. rescue StandardError => e
  16. puts "Error: #{e}"
  17. end
  18. end