Rubypedia extracts content like field=value from Wikipedia API.
At the moment it works only for rvsection=0:
http://#{lang}.wikipedia.org/w/api.php?action=query&prop=revisions&titles=#{title}&rvprop=content&format=json&rvsection=0
Via command line:
$ gem install rubypedia --source https://github.com/gcimmino/rubypedia.git
$ gem install
opts = {
:title => 'poland',
:fields => [ 'capital', 'currency', 'languages' ],
:lang => 'en'
}
puts Rubypedia.get_content(opts) #=> "Warsaw"