Created
July 20, 2015 08:33
-
-
Save koshian/f61a39b1da320c99fa42 to your computer and use it in GitHub Desktop.
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 | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
uri = 'http://b.hatena.ne.jp/hotentry' | |
query = '#main h3 a' | |
doc = Nokogiri::HTML.parse(open(uri).read) | |
doc.search(query).each do |e| | |
puts e.inner_html | |
puts e[:href] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment