-
-
Save hamajyotan/5d85e1e7aa9db7976e65 to your computer and use it in GitHub Desktop.
get wikipedia content by wikipedia api
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
#!/usr/bin/env ruby | |
# Usage: ./hoge KEYWORD | |
# | |
# ./hoge Java | |
# => | |
# 名前 Java<br/> パラダイム 構造化プログラミング 構造化・命令型プログラミング... | |
# | |
require 'net/http' | |
require 'json' | |
Net::HTTP.start('wikipedia.simpleapi.net') do |http| | |
res = http.get("/api?keyword=#{ARGV[0]}&output=json") | |
JSON.parse(r.body).each do |b| | |
puts b['body'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment