Last active
June 23, 2021 00:46
-
-
Save hiro88hyo/2964118 to your computer and use it in GitHub Desktop.
HorseList from netkeiba
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 'nokogiri' | |
require 'kconv' | |
f = File.open(ARGV[0]) | |
doc = Nokogiri::HTML(f.read.toutf8, nil, 'utf-8') | |
f.close | |
doc.search("//table[@class='nk_tb_common race_table_01']//tr[position()>1]").each{|tr| | |
row = Array.new | |
row.push tr.search("td[2]").text.chomp | |
row.push tr.search("td[2] > a").attribute("href").value | |
#doc.search("//p[@class='db_prof_top_kakikomi_num']//a").each{|a| | |
# puts a.text.tosjis | |
#} | |
row.push tr.search("td[3]").text.chomp | |
row.push tr.search("td[6] > a").text.chomp | |
row.push tr.search("td[7] > a").text.chomp | |
row.push tr.search("td[8] > a").text.chomp | |
row.push tr.search("td[9] > a").text.chomp | |
row.push tr.search("td[10] > a").text.chomp | |
row.push tr.search("td[11] > a").text.chomp | |
puts row.join(",") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment