Skip to content

Instantly share code, notes, and snippets.

@mmriis
Created October 14, 2011 10:35
Show Gist options
  • Save mmriis/1286783 to your computer and use it in GitHub Desktop.
Save mmriis/1286783 to your computer and use it in GitHub Desktop.
CVR.dk
http://cvr.dk/Site/Forms/PublicService/DisplayCompany.aspx?cvrnr=30505166
def extract_name(doc)
(doc/"div.titletext").inner_html.strip
end
def extract_address(doc)
(doc/"tr:contains('Adresse')/td.fieldvalue").inner_html =~ /^(.+)<br\W+\d{4}\W+(.+)$/
$~[1].strip.gsub("<br />", ", ")
end
def extract_zip(doc)
(doc/"tr:contains('Adresse')/td.fieldvalue").inner_html =~ /(\d{4})\W+(.+)$/
$~[1].strip
end
def extract_city(doc)
(doc/"tr:contains('Adresse')/td.fieldvalue").inner_html =~ /(\d{4})\W+(.+)$/
$~[2].strip
end
def extract_vat_number(doc)
(doc/"tr:contains('Cvr-nr')/td.fieldvalue").inner_html.strip
end
def extract_email(doc)
(doc/"tr:contains('Email')/td.fieldvalue").inner_html.strip
end
def extract_telephone(doc)
(doc/"tr:contains('Telefon')/td.fieldvalue").inner_html.strip
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment