Hi Guys,
new to RoR but I’ve been stuck on this problem for a few days now. So goal is to scrape this data – http://lol.esportspedia.com/wiki/Riot_League_Championship_Series/North_America/2015_Season/Summer_Season/Picks_and_Bans
-
and then organize it in the following format
-
the teams involved (top left, top right columns)
-
the match result (1,0)
-
the bans → relational to the team
-
the picks → relational to the team
-
the pick sequence
-
goes from 1-10, left picks 1st, right picks 2nd,3rd, left picks 4th n 5th (pattern goes to 10) currently using the Nokogiri gem and was able to scrape the data with the following code (saved the html and parsed it locally)
require ‘rubygems’
require ‘nokogiri’
require ‘open-uri’
require ‘csv’
f = File.open(“napb.html”)
doc = Nokogiri::XML(open(f))
CSV.open(“file21.csv”, “wb”) do |data|
doc.css(‘table.prettytable > *’).search(‘tr’).each do |tr|
data << tr.search('td').map(&:text)
end
end
I’ve been trying many different ways to put the data into arrays but I haven’t had much success. Anyone can point me in the right direction?
Thanks a bunch
Aries