Sha256: 1a637a7348ab304c67ae3889fb3f982a2277fe3dd8baeabaa69b252da3c2f422

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

#! /usr/bin/env ruby
# frozen_string_literal: true

require 'mechanize'
require 'csv'
require './lib/gman'

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 /UNIVERSITET/.match?(row['Namn'])
end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gman-7.0.5 script/vendor-se
gman-7.0.4 script/vendor-se