Skip to content

Instantly share code, notes, and snippets.

@kyaido
Created November 17, 2014 10:36
Show Gist options
  • Save kyaido/a7f4ccd92151bbf82a6d to your computer and use it in GitHub Desktop.
Save kyaido/a7f4ccd92151bbf82a6d to your computer and use it in GitHub Desktop.
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open("http://www.nedo.go.jp/library/fuuryoku/case/pref_01.html"))
data = doc.css(".basicSection div[id^='id']")
len = data.length
entries = Array.new
len.times {|i|
if data[i].nil? then
break
end
title = data[i].css("h4").inner_html
rowLen = data[i].css("table tr").length
operation = data[i].css("table tr:first-child th:first-child").inner_html # 稼動年月
entries << [title, operation]
}
File.open('.\test.txt',"w") do |file|
entries.each do |entry|
file.write("#{entry[0]}\r\n#{entry[1]}\r\n")
end
end

やりたいこと

Rubyでなんかしたい googlemap上にまとまっていること ぐぐりやすいように正式名称?がわかること アクセスがわかるとなおよい 写真が見れるといいよね

風車参考

日本における風力発電設備・導入実績 http://www.nedo.go.jp/library/fuuryoku/index.html

風力発電 | 各風力発電所データ | J POWER | 電源開発株式会社 http://www.jpower.co.jp/wind/win00100.html

風力発電.net - 日本の風力発電所一覧 http://風力発電.net/

日本全国の風力発電所一覧地図 | エレクトリカル・ジャパン - 発電所マップと夜景マップから考える日本の電力問題 http://agora.ex.nii.ac.jp/earthquake/201103-eastjapan/energy/electrical-japan/type/7.html.ja

プログラミング参考

Ruby & Railsの入門チュートリアル・まとめ【無料】 - 酒と泪とRubyとRailsと http://morizyun.github.io/blog/ruby-rails-free-reference-tutorial-curation/

Nokogiri を使った Rubyスクレイピング [初心者向けチュートリアル] - 酒と泪とRubyとRailsと http://morizyun.github.io/blog/ruby-nokogiri-scraping-tutorial/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment