lib/quiz/scraper.rb in soccer-quiz-0.1.3 vs lib/quiz/scraper.rb in soccer-quiz-0.1.4
- old
+ new
@@ -16,12 +16,12 @@
counter = 0
all_players = []
while counter < players[0].size
all_players << {:winner => players[0][counter],:year => players[0][counter + 1]}
counter += 2
- end
- all_players
+ end
+ all_players
end
def self.world_cup
world_cup_url = "https://www.foxsports.com/soccer/fifa-world-cup/history"
@@ -30,27 +30,27 @@
counter = 0
all_countries = []
while counter < world_cup[0].size
all_countries << {:year => world_cup[0][counter], :host => world_cup[0][counter + 1], :winner => world_cup[0][counter + 2], :runner_up => world_cup[0][counter + 3], :thirth_place => world_cup[0][counter + 4]}
counter += 9
- end
- all_countries
+ end
+ all_countries
end
def self.champion_league
champion_league_url = "https://en.wikipedia.org/wiki/List_of_European_Cup_and_UEFA_Champions_League_finals"
champion_league_file = "tbody"
- champions = self.scraper(champion_league_url,champion_league_file).map{|l|l.text.split("\n").reject{|e|e.empty?}}
+ champions = self.scraper(champion_league_url,champion_league_file).map{|l|l.text.split("\n").reject{|e| e.empty?}}
2.times{champions.shift}
10.times{champions[0].shift}
- 25.times{champions[0].pop}#22
+ 23.times{champions[0].pop}#22
champions[0].map{|item|item.strip}
counter = 0
all_teams = []
while counter < champions[0].size
all_teams << {:year => champions[0][counter], :winner => champions[0][counter + 2], :score => champions[0][counter + 3], :runner_up => champions[0][counter + 5], :host => champions[0][counter + 6]}
counter += 8
end
- all_teams
+ all_teams
end
end