Skip to content

Instantly share code, notes, and snippets.

@hiro88hyo
Last active June 23, 2021 00:46
Show Gist options
  • Save hiro88hyo/2964118 to your computer and use it in GitHub Desktop.
Save hiro88hyo/2964118 to your computer and use it in GitHub Desktop.
HorseList from netkeiba
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