Sha256: 64a60ee6bb20c3bd5d317772cebc16ff99da3cbfd4874ef67252073f803ada17

Contents?: true

Size: 616 Bytes

Versions: 2

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 do |row|
  row['Webbadress'] unless row['Namn'] =~ /UNIVERSITET/
end

Gman.import('Swedish Administrative Authorities' => domains)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gman-6.0.1 script/vendor-se
gman-6.0.0 script/vendor-se