Hello,
Time flies! After some years I have finally updated the world
factbook.json datasets [1]
and the "chrome-less" country profile web pages [2] using the latest
online country profile pages from the Official CIA World Factbook
website.
The web page structure has changed a little so I have updated the
factbook page parser [3] too -
packaged up in the factbook-reader gem / library for easy (re)use.
If you find anything of notice in the updated datasets, pages,
parser, etc. please tell.
From the readme:
Get country profile page as a hash (that is, structured data e.g.
nested key/values)
page = Factbook::Page.new( 'br' ) # br is the country code for Brazil
pp page.data # pretty print hash
resulting in:
{"Introduction"=>
{"Background"=>
{"text"=>
"Following more than three centuries under Portuguese rule,
Brazil gained its independence in 1822, ..."}},
"Geography"=>
{"Location"=>{"text"=>"Eastern South America, bordering the Atlantic Ocean"},
"Geographic coordinates"=>{"text"=>"10 00 S, 55 00 W"},
...
Save to disk as JSON
page = Factbook::Page.new( 'br' )
File.open( 'br.json', 'w:utf-8') do |f|
f.write page.to_json
end
List all codes
Factbook.codes.each do |code|
pp code
end
and so on.
Happy exploring the world. Cheers. Prost.
PS: Geo Quiz: What’s the name of the country? __________________
The country is landlocked; strategic location at the crossroads of
central Europe
with many easily traversable Alpine passes and valleys;
major river is the Danube; population is concentrated on eastern lowlands
because of steep slopes, poor soils, and low temperatures elsewhere.
[1] https://github.com/factbook/factbook.json
[2] http://factbook.github.io
[3] https://github.com/factbook/factbook/tree/master/factbook-readers