soccer-quiz 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +16 -4
- data/bin/console +4 -2
- data/bin/quiz +1 -0
- data/lib/.DS_Store +0 -0
- data/lib/quiz/scraper.rb +15 -13
- data/lib/quiz/version.rb +1 -1
- data/lib/quiz.rb +3 -0
- metadata +5 -4
- data/bin/nokogiri +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58f9e7aec23eb5f33341e9e87a1de33647da4c2ab372bc38d2cb7d2e9f80a66e
|
4
|
+
data.tar.gz: 4fe91c8ed3673bfa59895bc1b18e2fe59489a342fe829ebbeb9abc8f2e4ddc9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f5490144a6172a4e58b96e1e3e7745befb0ae747a68d6744ebf71c5e1950e3e3ab5047b560882f8ec6b6b3f4c62f8e08c8d1bee33d23742cda0fce886a85b97
|
7
|
+
data.tar.gz: 0aab7a0d118a1fcbd1da3358db069292809ff5df84180f5f005a8c0bf75cf4423cc996a699958606fd29f19e2effcc76659e28e33d2a223f231706c6debd193f
|
data/.DS_Store
ADDED
Binary file
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
soccer-quiz (0.2.
|
4
|
+
soccer-quiz (0.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
date (3.2.2)
|
9
10
|
diff-lcs (1.3)
|
10
|
-
mini_portile2 (2.
|
11
|
-
nokogiri (1.
|
12
|
-
mini_portile2 (~> 2.
|
11
|
+
mini_portile2 (2.8.0)
|
12
|
+
nokogiri (1.13.8)
|
13
|
+
mini_portile2 (~> 2.8.0)
|
14
|
+
racc (~> 1.4)
|
15
|
+
open-uri (0.2.0)
|
16
|
+
stringio
|
17
|
+
time
|
18
|
+
uri
|
19
|
+
racc (1.6.0)
|
13
20
|
rake (13.0.1)
|
14
21
|
rspec (3.9.0)
|
15
22
|
rspec-core (~> 3.9.0)
|
@@ -24,6 +31,10 @@ GEM
|
|
24
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
32
|
rspec-support (~> 3.9.0)
|
26
33
|
rspec-support (3.9.3)
|
34
|
+
stringio (3.0.2)
|
35
|
+
time (0.2.0)
|
36
|
+
date
|
37
|
+
uri (0.11.0)
|
27
38
|
|
28
39
|
PLATFORMS
|
29
40
|
ruby
|
@@ -31,6 +42,7 @@ PLATFORMS
|
|
31
42
|
DEPENDENCIES
|
32
43
|
bundler
|
33
44
|
nokogiri
|
45
|
+
open-uri
|
34
46
|
rake (>= 12.3.3)
|
35
47
|
rspec
|
36
48
|
soccer-quiz!
|
data/bin/console
CHANGED
@@ -2,10 +2,12 @@
|
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "quiz"
|
5
|
+
require_relative '../lib/quiz'
|
5
6
|
|
6
7
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
7
8
|
# require "pry"
|
8
9
|
# Pry.start
|
9
10
|
|
10
|
-
require "irb"
|
11
|
-
IRB.start(__FILE__)
|
11
|
+
# require "irb"
|
12
|
+
# IRB.start(__FILE__)
|
13
|
+
Quiz::Scraper.nyc_buildings_violations
|
data/bin/quiz
CHANGED
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/quiz/scraper.rb
CHANGED
@@ -3,40 +3,40 @@ class Quiz::Scraper
|
|
3
3
|
|
4
4
|
|
5
5
|
def self.scraper(url,clas)
|
6
|
-
doc = Nokogiri::HTML(open(url))
|
6
|
+
doc = Nokogiri::HTML(URI.open(url))
|
7
7
|
doc.css(clas)
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.balon_d_or_players
|
10
|
+
def self.balon_d_or_players
|
11
11
|
balon_d_or_url = "https://www.goal.com/es/noticias/todos-los-ganadores-del-balon-de-oro/wn19xivn1eh91t0jrslbzz5kq"
|
12
12
|
balon_de_or_files = "table"
|
13
13
|
|
14
14
|
players = self.scraper(balon_d_or_url,balon_de_or_files).map{|l|l.text}
|
15
|
-
years = players[
|
16
|
-
years[
|
17
|
-
players = players[
|
18
|
-
players[0] = "
|
19
|
-
players[
|
15
|
+
years = players[0].split(/\D/).reject{|e|e.empty?}
|
16
|
+
years[2] = "2020"
|
17
|
+
players = players[0].split(/\d/).reject{|e|e.empty?}
|
18
|
+
players[0] = "Karim Benzema"
|
19
|
+
players[2] = "Event was Cancel because Covi-19"
|
20
20
|
counter = 0
|
21
21
|
all_players = []
|
22
22
|
while counter < players.size
|
23
23
|
all_players << {:winner => players[counter],:year => years[counter]}
|
24
24
|
counter += 1
|
25
25
|
end
|
26
|
-
|
27
|
-
p all_players
|
26
|
+
all_players
|
28
27
|
end
|
29
28
|
|
30
29
|
|
31
30
|
def self.world_cup
|
32
31
|
world_cup_url = "https://www.foxsports.com/soccer/fifa-world-cup/history"
|
33
32
|
world_cup = "tbody"
|
33
|
+
|
34
34
|
world_cup = self.scraper(world_cup_url,world_cup).map{|l|l.text.split(/\r\n|\s{2,}/).reject{|e|e.empty?}}
|
35
35
|
counter = 0
|
36
36
|
all_countries = []
|
37
37
|
while counter < world_cup[0].size
|
38
|
-
all_countries << {:year => world_cup[0][counter], :host => world_cup[0][counter +
|
39
|
-
counter +=
|
38
|
+
all_countries << {:year => world_cup[0][counter], :host => world_cup[0][counter + 4], :winner => world_cup[0][counter + 1], :runner_up => world_cup[0][counter + 2], :thirth_place => world_cup[0][counter + 3]}
|
39
|
+
counter += 8
|
40
40
|
end
|
41
41
|
all_countries
|
42
42
|
end
|
@@ -50,15 +50,17 @@ class Quiz::Scraper
|
|
50
50
|
champions.shift
|
51
51
|
champions.shift
|
52
52
|
10.times{champions[0].shift}
|
53
|
-
|
53
|
+
21.times{champions[0].pop}
|
54
54
|
2.times{champions[0].delete_at(152)}
|
55
|
+
champions
|
55
56
|
counter = 0
|
56
57
|
all_teams = []
|
57
58
|
while counter < champions[0].size
|
58
59
|
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]}
|
59
60
|
counter += 8
|
60
61
|
end
|
61
|
-
|
62
|
+
all_teams
|
62
63
|
end
|
64
|
+
|
63
65
|
end
|
64
66
|
|
data/lib/quiz/version.rb
CHANGED
data/lib/quiz.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soccer-quiz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yarvin Hernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -74,6 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".DS_Store"
|
77
78
|
- ".gitignore"
|
78
79
|
- CODE_OF_CONDUCT.md
|
79
80
|
- Gemfile
|
@@ -85,12 +86,12 @@ files:
|
|
85
86
|
- bin/console
|
86
87
|
- bin/htmldiff
|
87
88
|
- bin/ldiff
|
88
|
-
- bin/nokogiri
|
89
89
|
- bin/quiz
|
90
90
|
- bin/rake
|
91
91
|
- bin/rspec
|
92
92
|
- bin/setup
|
93
93
|
- config/environment.rb
|
94
|
+
- lib/.DS_Store
|
94
95
|
- lib/quiz.rb
|
95
96
|
- lib/quiz/balon_d_or.rb
|
96
97
|
- lib/quiz/champion_league.rb
|
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
120
|
- !ruby/object:Gem::Version
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.3.22
|
123
124
|
signing_key:
|
124
125
|
specification_version: 4
|
125
126
|
summary: 10 questions quiz about soccer.
|
data/bin/nokogiri
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'nokogiri' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "pathname"
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
-
Pathname.new(__FILE__).realpath)
|
14
|
-
|
15
|
-
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
-
|
17
|
-
if File.file?(bundle_binstub)
|
18
|
-
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
-
load(bundle_binstub)
|
20
|
-
else
|
21
|
-
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
-
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
require "rubygems"
|
27
|
-
require "bundler/setup"
|
28
|
-
|
29
|
-
load Gem.bin_path("nokogiri", "nokogiri")
|