Created
October 14, 2011 10:35
-
-
Save mmriis/1286783 to your computer and use it in GitHub Desktop.
CVR.dk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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