Skip to content

Instantly share code, notes, and snippets.

@chunlea
Forked from yesmeck/stock.rb
Created May 26, 2013 13:45
Show Gist options
  • Save chunlea/5652842 to your computer and use it in GitHub Desktop.
Save chunlea/5652842 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'nokogiri'
code = 2904
doc = Nokogiri::HTML(open("http://just2.entrust.com.tw/z/zc/zca/zca_#{code}.djhtm"))
# 當前股價,既網頁中的收盤價
doc.css('table')[2].css('tr')[1].css('td').last.inner_text.to_f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment