Sha256: 05b6d370a0936c6f9d561b6d16b6e755ac0eab34dd17be5c870a6b28a0627a36

Contents?: true

Size: 466 Bytes

Versions: 7

Compression:

Stored size: 466 Bytes

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'infoboxer'
require 'yaml'

countries = Infoboxer.wp.
  get('List of countries by continent').
  sections.first.
  sections.tables.lookup(:Wikilink, :bold?).
  reject{|l| l.link == 'India'}. # as of 28.12, India page is broken
  follow

File.write 'script/out/categories.txt',
  countries.categories.map(&:link).group_by(&:itself).sort.
    map{|cat, group| "#{cat}: #{group.count}"}.join("\n")

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
reality-0.1.0.alpha2 script/extract_country_categories.rb
reality-0.1.0.alpha script/extract_country_categories.rb
reality-0.0.5 script/extract_country_categories.rb
reality-0.0.4 script/extract_country_categories.rb
reality-0.0.3 script/extract_country_categories.rb
reality-0.0.2 script/extract_country_categories.rb
reality-0.0.1 script/extract_country_categories.rb