Sha256: 41ea12dc2eb88af2b151cb5974358197dadf3a9283f656c9ff06ff7876d1f79c

Contents?: true

Size: 743 Bytes

Versions: 3

Compression:

Stored size: 743 Bytes

Contents

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

require 'csv'
require 'open-uri'
require './lib/gman'

url = 'http://www.mik.nrw.de/nc/themen-aufgaben/kommunales/kommunale-adressen.html?tx_szkommunaldb_pi1%5Bexport%5D=csv'

csv = URI.open(url).read.force_encoding('iso-8859-1').encode('UTF-8')

# For some reason, the header row is actually the last row
# Pop the last line off the file and prepend it at the begining
# So that when we pass it to CSV it detects the headers properly
lines = csv.split("\n")
lines.unshift lines.pop
csv = lines.join("\n")

# Load municipal domains
data = CSV.parse(csv, headers: true, col_sep: ';')
domains = data.map { |row| row['Internet'] }

Gman::Importer.new('German Municipalities' => domains).import

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gman-7.0.5 script/vendor-municipal-de
gman-7.0.4 script/vendor-municipal-de
gman-7.0.3 script/vendor-municipal-de