Skip to content

Commit

Permalink
Merge pull request #2 from everypolitician-scrapers/fix-missing-space…
Browse files Browse the repository at this point in the history
…-in-party-name

Fix missing space in party name
  • Loading branch information
tmtmtmtm committed Oct 17, 2016
2 parents 3bc17f5 + c6b3626 commit 5bac93e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scraper.rb
Expand Up @@ -5,6 +5,12 @@
require 'nokogiri'
require 'scraped_page_archive/open-uri'

class String
def tidy
gsub(/[[:space:]]+/, ' ').strip
end
end

def noko_for(url)
Nokogiri::HTML(open(url).read)
end
Expand Down Expand Up @@ -34,7 +40,7 @@ def scrape_list(url)
data = {
name: name,
gender: gender,
faction: tds[2].text,
faction: tds[2].children.map(&:text).join(" ").tidy,
image: URI.join(url, tds[0].css('img/@src').to_s).to_s,
area: tds[3].text,
term: 46,
Expand Down

0 comments on commit 5bac93e

Please sign in to comment.