一个例子, ruby 解析 html页面. ( nokogiri, httparty, ruby)

访问量: 1263

有些网页需要我们获取信息

require 'httparty'
require 'nokogiri'

url ='https://github.com/rdoc/rdoc/issues/190'
response = HTTParty.get  url 
puts response.body
doc = Nokogiri::HTML response.body
doc.css('.js-issue-title').each do  |node|
  puts node.content
end

保存下来后,   
$ gem install httparty

$ gem install nokogiri

就可以直接运行   

订阅/RSS Feed

Subscribe

分类/category