Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
MLB Draft 2014: If teams were comprised solely of players they drafted (results of each team)
require 'httparty'
require 'nokogiri'
page = HTTParty.get('http://www.brewcrewball.com/2014/6/5/5328814/mlb-draft-players-roster-construction-brewers-yankees-red-sox-dodgers')
doc = Nokogiri::HTML(page.body)
i = 0
doc.css('#article-body h3').each do |t|
next if t.text.empty?
team = t.text
trs = doc.css('#article-body table')[i].css('tr')
rwar = 0.0
trs.each do |t|
if t.css('td')[0].text == "Position"
else
rwar += t.css('td').last.text.to_f
end
end
puts "#{team}: #{rwar.round}"
i += 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.