Skip to content

Commit

Permalink
require Scraped
Browse files Browse the repository at this point in the history
We don't actually _use_ it yet, but it provides us with String.tidy and Nokogiri
  • Loading branch information
tmtmtmtm committed Mar 3, 2017
1 parent df6fee0 commit 02d31c3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scraper.rb
Expand Up @@ -2,16 +2,13 @@
# #!/bin/env ruby
# encoding: utf-8

require 'scraperwiki'
require 'nokogiri'
require 'scraped_page_archive/open-uri'
require 'date'
require 'scraped'
require 'scraperwiki'

class String
def tidy
gsub(/[[:space:]]+/, ' ').strip
end
end
# require 'open-uri/cached'
# OpenURI::Cache.cache_path = '.cache'
require 'scraped_page_archive/open-uri'

def noko_for(url)
Nokogiri::HTML(open(url).read)
Expand Down Expand Up @@ -119,6 +116,7 @@ def scrape_person(url, term_map)
end

data = data.merge(social_details)
# puts data.reject { |k,v| v.to_s.empty? }.sort_by { |k,v| k }.to_h

if data[:term].nil?
ScraperWiki.save_sqlite([:id], data)
Expand Down

0 comments on commit 02d31c3

Please sign in to comment.