Module: EaSportsPpi
- Defined in:
- lib/ea_sports_ppi.rb,
lib/ea_sports_ppi/version.rb
Constant Summary collapse
- VERSION =
"0.0.5"
Class Method Summary collapse
-
.run ⇒ Object
Your code goes here…
Class Method Details
.run ⇒ Object
Your code goes here…
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 |