module EaSportsPpi
Constants
- VERSION
Public Class Methods
run()
click to toggle source
Your code goes hereā¦
# File lib/ea_sports_ppi.rb, line 9 def self.run() doc=Nokogiri::HTML(open("http://www.premierleague.com/en-gb/players/ea-sports-player-performance-index/")) tables=doc.xpath('/html/body/div/div/div/div/div/div/div/form/div/table') table = Ruport::Data::Table.new table.column_names = %w[PLAYER INDEX] tables[0].xpath('tbody/tr').each do |tr| #print(tr.xpath('td[4]').inner_text.strip, " ", tr.xpath('td[14]').inner_text.strip, "\n") array = Array.new array << tr.xpath('td[4]').inner_text.strip array << tr.xpath('td[14]').inner_text.strip table << array end puts table.to_text end