Last active
September 8, 2015 11:19
-
-
Save omoshetech-t/e6d8a25e4667e46af251 to your computer and use it in GitHub Desktop.
Japanese SEO keyword suggestion tool.
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
require 'json' | |
require 'open-uri' | |
def complete(query) | |
q = URI.escape(query) | |
url = "http://suggestqueries.google.com/complete/search?q=#{q}&client=firefox&hl=ja" | |
json = open(url).read | |
JSON.parse(json).last | |
end | |
keywords = ARGV.join(' ') | |
abort("Usage: ruby #{$0} keyword ...") if keywords.empty? | |
chars = (?a..?z).to_a + (?ァ..?ヶ).to_a | |
puts chars.map { |char| complete("#{keywords} #{char}") } | |
.flatten.uniq.sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment