Phone calling codes (aka International Dialing codes) – DB Dump / YML format

Parsed from: http://en.wikipedia.org/wiki/List_of_country_calling_codes with Hpricot:

doc = Hpricot(open("http://en.wikipedia.org/wiki/List_of_country_calling_codes"))
table = (doc/"table")[4]
by_country = {}
table.search('/tr').each {|tr| tr0 = tr.search('/td')[0] ; tr1 = tr.search('/td')[1]; by_country[tr0.inner_html.gsub(/<.*>/,  "")] = tr1.search('/a').inner_html.gsub(" ", '').split(/\+/).select{|val| !val.empty?}.map(&:to_i) if tr1  } ; nil

Phone calling codes (MySQL dump)

Phone calling codes by country (YML format)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: