Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

MLB Draft 2014: If teams were comprised solely of players they drafted (results of each team)

View gist:f4eb8797939da1dadfb1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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.