Last active
August 29, 2015 14:15
-
-
Save shirayuca/fcc3efdc3ddc2d2ca04c to your computer and use it in GitHub Desktop.
vorkers_detail_repeat_2.rb
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
http://www.vorkers.com/company.php?m_id=a0910000000Fr7P | |
http://www.vorkers.com/company.php?m_id=a0910000000Fr6b | |
http://www.vorkers.com/company.php?m_id=a0910000000Frvw |
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 'open-uri' | |
require 'nokogiri' | |
def getList(company_url) | |
charset = nil | |
html = open(company_url) do |f| | |
charset = f.charset | |
f.read | |
end | |
doc = Nokogiri::HTML.parse(html, nil, charset) | |
# 会社名、クチコミ件数 | |
doc.xpath('//h2[@id="mainTitle"]').each do |node| | |
print node.text + "," | |
end | |
# 総合評価 | |
doc.xpath('//span[@property="v:average"]').each do |node| | |
print node.text + "," | |
end | |
# 総合評価の回答者数 | |
doc.xpath('//span[@property="v:votes"]').each do |node| | |
print node.text + "," | |
end | |
# 残業時間(月間) | |
doc.xpath('//dl[@class="averageScore_pickupScore mr-15"]/dd').each do |node| | |
print node.text + "," | |
end | |
# 有給休暇消化率 | |
doc.xpath('//dl[@class="averageScore_pickupScore"]/dd').each do |node| | |
print node.text + "," | |
end | |
# table内の指標 | |
doc.css('.averageScore_right table').each do |table| | |
table.css('tr td').each do |node| | |
print node.text + "," | |
end | |
end | |
print "\n" | |
end | |
open('companylist.txt').each do |line| | |
print line.chomp! + "," | |
getList(line) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment