Skip to content

Instantly share code, notes, and snippets.

@shirayuca
Created December 23, 2014 15:39
Show Gist options
  • Save shirayuca/50498d55c1de45d43728 to your computer and use it in GitHub Desktop.
Save shirayuca/50498d55c1de45d43728 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'nokogiri'
url = 'http://www.vorkers.com/company.php?m_id=a0910000000Fr7P'
charset = nil
html = open(url) do |f|
charset = f.charset
f.read
end
doc = Nokogiri::HTML.parse(html, nil, charset)
doc.xpath('//ul/li[@class="r1"]').each do |node|
p node.text
end
doc.xpath('//ul/li[@class="r2"]').each do |node|
p node.text
end
doc.xpath('//ul/li[@class="r1_2"]/span[@class="suchiup"]').each do |node|
p node.text
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment