Sha256: 278e69348db08810fd6bc14a9819abaffc0b02cfbcccac116a8034cb4d7cd720
Contents?: true
Size: 616 Bytes
Versions: 12
Compression:
Stored size: 616 Bytes
Contents
#! /usr/bin/env ruby require 'mechanize' require 'csv' require './lib/gman' require './lib/gman/importer' url = "http://www.myndighetsregistret.scb.se/Myndighet.aspx" agent = Mechanize.new page = agent.get(url) form = page.forms.first form.radiobuttons.find { |r| r.value = "Textfil" }.check submit_button = form.buttons.find { |b| b.type == "submit" } response = agent.submit(form, submit_button) rows = CSV.parse(response.content, :headers => true, :col_sep => "\t") domains = rows.map { |row| row["Webbadress"] unless row["Namn"] =~ /UNIVERSITET/} Gman.import("Swedish Administrative Authorities" => domains)
Version data entries
12 entries across 12 versions & 1 rubygems