Sha256: 9eeedc7ec54b66c12bbb312657a71014105070b3eb95b69d1bd388a5ef926901

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

#! /usr/bin/env ruby

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

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

csv = 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.import('German Municipalities' => domains)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gman-6.0.1 script/vendor-municipal-de
gman-6.0.0 script/vendor-municipal-de