Last active
December 16, 2015 18:20
-
-
Save csouls/5476766 to your computer and use it in GitHub Desktop.
GitのCommit logに"fix"とか書くくらいだったら名言書いとこうってことで、http://www.meigensyu.com/ から名言をランダムで取ってくるRuby script。
This file contains hidden or 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 'rubygems' | |
require 'mechanize' | |
require 'rainbow' | |
m = Mechanize.new | |
m.get('http://www.meigensyu.com/quotations/view/random/') do |random| | |
m.get(random.uri) do |page| | |
text = page.parser.xpath('//div[@class="meigenbox"]/div[@class="text"]').text | |
puts Rainbow(text).color(:blue) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment