webget-football 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +20 -0
  3. data/Rakefile +1 -0
  4. data/lib/webget-football.rb +8 -0
  5. data/lib/webget-football/apis.rb +1 -0
  6. data/lib/webget-football/apis/download.rb +22 -2
  7. data/lib/webget-football/apis/leagues.rb +51 -0
  8. data/lib/webget-football/fbref.rb +7 -0
  9. data/lib/webget-football/fbref/config.rb +14 -0
  10. data/lib/webget-football/fbref/download.rb +41 -0
  11. data/lib/webget-football/fbref/leagues.rb +47 -0
  12. data/lib/webget-football/fbref/page.rb +32 -0
  13. data/lib/webget-football/fbref/page_schedule.rb +322 -0
  14. data/lib/webget-football/metal.rb +19 -0
  15. data/lib/webget-football/version.rb +1 -1
  16. data/lib/webget-football/worldfootball.rb +1 -0
  17. data/lib/webget-football/worldfootball/download.rb +61 -28
  18. data/lib/webget-football/worldfootball/leagues.rb +200 -0
  19. data/lib/webget-football/worldfootball/leagues/asia.rb +53 -0
  20. data/lib/webget-football/worldfootball/leagues/europe--british_isles.rb +59 -0
  21. data/lib/webget-football/worldfootball/leagues/europe--central.rb +127 -0
  22. data/lib/webget-football/worldfootball/leagues/europe--eastern.rb +82 -0
  23. data/lib/webget-football/worldfootball/leagues/europe--northern.rb +57 -0
  24. data/lib/webget-football/worldfootball/leagues/europe--southern.rb +86 -0
  25. data/lib/webget-football/worldfootball/leagues/europe--western.rb +38 -0
  26. data/lib/webget-football/worldfootball/leagues/europe.rb +13 -0
  27. data/lib/webget-football/worldfootball/leagues/north_america.rb +44 -0
  28. data/lib/webget-football/worldfootball/leagues/pacific.rb +21 -0
  29. data/lib/webget-football/worldfootball/leagues/south_america.rb +11 -0
  30. data/lib/webget-football/worldfootball/page_report.rb +1 -1
  31. data/lib/webget-football/worldfootball/page_schedule.rb +1 -1
  32. metadata +36 -2
@@ -0,0 +1,127 @@
1
+
2
+ module Worldfootball
3
+
4
+
5
+ LEAGUES_EUROPE.merge!({
6
+
7
+ # /2-bundesliga-{season}/
8
+ # /2-bundesliga-2013-2014/
9
+ # /dfb-pokal-2019-2020/
10
+
11
+ 'de.1' => { pages: 'bundesliga' },
12
+ 'de.2' => { pages: '2-bundesliga' },
13
+ 'de.3' => { pages: '3-liga' },
14
+ 'de.cup' => { pages: 'dfb-pokal' },
15
+
16
+
17
+
18
+ ## note: use aut-2-liga !!! starting 2019-2018 !!!
19
+ ## use aut-erste-liga !!! before e.g. 2010-2011 etc.
20
+ #
21
+ # /aut-erste-liga-{season}/
22
+ # /aut-bundesliga-2010-2011/
23
+ # /aut-erste-liga-2010-2011/
24
+ # /aut-oefb-cup-2019-2020/
25
+
26
+ =begin
27
+ 2019/2020 Qualifikationsgruppe -- >/alle_spiele/aut-bundesliga-2019-2020-qualifikationsgruppe/<
28
+ 2019/2020 Playoff -- >/alle_spiele/aut-bundesliga-2019-2020-playoff/<
29
+ 2019/2020 Meistergruppe -- >/alle_spiele/aut-bundesliga-2019-2020-meistergruppe/<
30
+ 2019/2020 -- >/alle_spiele/aut-bundesliga-2019-2020/<
31
+ 2018/2019 Qualifikationsgruppe -- >/alle_spiele/aut-bundesliga-2018-2019-qualifikationsgruppe/<
32
+ 2018/2019 Playoff -- >/alle_spiele/aut-bundesliga-2018-2019-playoff/<
33
+ 2018/2019 Meistergruppe -- >/alle_spiele/aut-bundesliga-2018-2019-meistergruppe/<
34
+ =end
35
+
36
+ 'at.1' => {
37
+ pages: {
38
+ 'aut-bundesliga-{season}' => 'Grunddurchgang', # 1
39
+ 'aut-bundesliga-{season}-meistergruppe' => 'Finaldurchgang - Meister', # 2
40
+ 'aut-bundesliga-{season}-qualifikationsgruppe' => 'Finaldurchgang - Qualifikation', # 3
41
+ 'aut-bundesliga-{season}-playoff' => 'Europa League Play-off', # 4
42
+ },
43
+ season: ->( season ) {
44
+ case season
45
+ when Season('2020/21') then [1]
46
+ when Season('2018/19')..Season('2019/20') then [1,2,3,4]
47
+ else 1 ## use simple format for the rest; note: index NOT wrapped in array
48
+ end
49
+ },
50
+ },
51
+ 'at.2' => {
52
+ pages: ['aut-2-liga',
53
+ 'aut-erste-liga'],
54
+ season: ->(season) { season.start_year >= 2019 ? 1 : 2 }
55
+ },
56
+ # /aut-regionalliga-ost-2020-2021/
57
+ 'at.3.o' => { pages: 'aut-regionalliga-ost' },
58
+ 'at.cup' => { pages: 'aut-oefb-cup' },
59
+
60
+
61
+ # /sui-super-league-2019-2020/
62
+ # /sui-challenge-league-2019-2020/
63
+
64
+ 'ch.1' => { pages: 'sui-super-league' },
65
+ 'ch.2' => { pages: 'sui-challenge-league' },
66
+
67
+ # /hun-nb-i-2020-2021/
68
+ 'hu.1' => { pages: 'hun-nb-i' },
69
+
70
+ # /cze-1-fotbalova-liga-2020-2021/
71
+ 'cz.1' => {
72
+ pages: {
73
+ 'cze-1-fotbalova-liga-{season}' => 'Regular Season', # 1
74
+ },
75
+ season: ->( season ) {
76
+ case season
77
+ when Season('2020/21') then [1] # just getting started
78
+ end
79
+ }
80
+ },
81
+
82
+
83
+ # /pol-ekstraklasa-2020-2021/
84
+ # /pol-ekstraklasa-2019-2020-playoffs/
85
+ # /pol-ekstraklasa-2019-2020-abstieg/
86
+ #
87
+ # championship round (top eight teams) and
88
+ # relegation round (bottom eight teams)
89
+ 'pl.1' => {
90
+ pages: {
91
+ 'pol-ekstraklasa-{season}' => 'Regular Season', # 1
92
+ 'pol-ekstraklasa-{season}-playoffs' => 'Playoffs - Championship', # 2
93
+ 'pol-ekstraklasa-{season}-abstieg' => 'Playoffs - Relegation', # 3
94
+ },
95
+ season: ->( season ) {
96
+ case season
97
+ when Season('2020/21') then [1] # just getting started
98
+ when Season('2019/20') then [1,2,3]
99
+ when Season('2018/19') then [1,2,3]
100
+ end
101
+ }
102
+ },
103
+
104
+ # /svk-super-liga-2020-2021/
105
+ # /svk-super-liga-2019-2020-meisterschaft/
106
+ # /svk-super-liga-2019-2020-abstieg/
107
+ # /svk-super-liga-2019-2020-europa-league/
108
+ 'sk.1' => {
109
+ pages: {
110
+ 'svk-super-liga-{season}' => 'Regular Season', # 1
111
+ 'svk-super-liga-{season}-meisterschaft' => 'Playoffs - Championship', # 2
112
+ 'svk-super-liga-{season}-abstieg' => 'Playoffs - Relegation', # 3
113
+ 'svk-super-liga-{season}-europa-league' => 'Europa League Finals', # 4
114
+ },
115
+ season: ->( season ) {
116
+ case season
117
+ when Season('2020/21') then [1] # getting started
118
+ when Season('2019/20') then [1,2,3,4]
119
+ when Season('2018/19') then [1,2,3] # note: no europa league finals / playoffs
120
+ end
121
+ }
122
+ },
123
+
124
+
125
+ })
126
+
127
+ end
@@ -0,0 +1,82 @@
1
+
2
+ module Worldfootball
3
+
4
+ LEAGUES_EUROPE.merge!({
5
+
6
+ # /rou-liga-1-2019-2020
7
+ # /rou-liga-1-2019-2020-championship
8
+ # /rou-liga-1-2019-2020-relegation
9
+ # ..
10
+ # /rom-liga-1-2015-2016
11
+ # /rom-liga-1-2015-2016-championship
12
+ # /rou-liga-1-2015-2016-relegation
13
+
14
+
15
+ 'ro.1' => {
16
+ pages: {
17
+ 'rou-liga-1-{season}' => 'Regular Season',
18
+ 'rou-liga-1-{season}-championship' => 'Playoffs - Championship',
19
+ 'rou-liga-1-{season}-relegation' => 'Playoffs - Relegation',
20
+ ## note: change of country code from rou to rom in slug in 2015/16!!!
21
+ 'rom-liga-1-{season}' => 'Regular Season',
22
+ 'rom-liga-1-{season}-championship' => 'Playoffs - Championship',
23
+ 'rom-liga-1-{season}-relegation' => 'Playoffs - Relegation',
24
+ },
25
+ season: ->( season ) {
26
+ case season
27
+ when Season('2020/21') then [1] # just getting started
28
+ when Season('2016/17')..Season('2019/20') then [1,2,3]
29
+ when Season('2015/16') then [4,5,3] # handle special case with weird mixed slugs
30
+ when Season('2010/11')..Season('2014/15') then 4 ## use simple format for the rest; note: index NOT wrapped in array
31
+ end
32
+ }
33
+ },
34
+
35
+ # rus-premier-liga-2020-2021
36
+ # ..
37
+ # rus-premier-liga-2012-2013
38
+ #
39
+ # rus-premier-liga-2011-2012
40
+ # rus-premier-liga-2011-2012-meisterschaft
41
+ # rus-premier-liga-2011-2012-relegation
42
+ #
43
+ # rus-premier-liga-2010
44
+ 'ru.1' => {
45
+ pages: {
46
+ 'rus-premier-liga-{season}' => 'Regular Season',
47
+ 'rus-premier-liga-{season}-meisterschaft' => 'Playoffs - Championship',
48
+ 'rus-premier-liga-{season}-relegation' => 'Playoffs - Relegation',
49
+ },
50
+ season: ->( season ) {
51
+ case season
52
+ when Season('2012/13')..Season('2020/21') then 1 ## use simple format for the rest; note: index NOT wrapped in array
53
+ when Season('2011/12') then [1,2,3]
54
+ when Season('2004')..Season('2010') then 1 ## use simple format for the rest; note: index NOT wrapped in array
55
+ end
56
+ }
57
+ },
58
+ 'ru.2' => { pages: 'rus-1-division' },
59
+
60
+ # /ukr-premyer-liga-2019-2020/
61
+ # /ukr-premyer-liga-2019-2020-meisterschaft/
62
+ # /ukr-premyer-liga-2019-2020-abstieg/
63
+ # /ukr-premyer-liga-2019-2020-playoffs-el/
64
+ 'ua.1' => {
65
+ pages: {
66
+ 'ukr-premyer-liga-{season}' => 'Regular Season',
67
+ 'ukr-premyer-liga-{season}-meisterschaft' => 'Playoffs - Championship',
68
+ 'ukr-premyer-liga-{season}-abstieg' => 'Playoffs - Relegation',
69
+ 'ukr-premyer-liga-{season}-playoffs-el' => 'Europa League Finals',
70
+ },
71
+ season: ->( season ) {
72
+ case season
73
+ when Season('2019/20') then [1,2,3,4]
74
+ when Season('2018/19') then [1,2,3] # note: no europa league finals / playoffs
75
+ end
76
+ }
77
+ },
78
+
79
+ })
80
+
81
+ end
82
+
@@ -0,0 +1,57 @@
1
+
2
+ module Worldfootball
3
+
4
+ LEAGUES_EUROPE.merge!({
5
+ # e.g. /isl-urvalsdeild-2020/
6
+ 'is.1' => { pages: 'isl-urvalsdeild' },
7
+
8
+ # e.g. /swe-allsvenskan-2020/
9
+ # /swe-superettan-2020/
10
+ 'se.1' => { pages: 'swe-allsvenskan' },
11
+ 'se.2' => { pages: 'swe-superettan' },
12
+
13
+ # e.g. /nor-eliteserien-2020/
14
+ 'no.1' => { pages: 'nor-eliteserien' },
15
+
16
+ # e.g. /fin-veikkausliiga-2019/
17
+ # /fin-veikkausliiga-2019-meisterschaft/
18
+ # /fin-veikkausliiga-2019-abstieg/
19
+ # /fin-veikkausliiga-2019-playoff-el/
20
+ 'fi.1' => {
21
+ pages: {
22
+ 'fin-veikkausliiga-{season}' => 'Regular Season',
23
+ 'fin-veikkausliiga-{season}-meisterschaft' => 'Playoffs - Championship',
24
+ 'fin-veikkausliiga-{season}-abstieg' => 'Playoffs - Challenger',
25
+ 'fin-veikkausliiga-{season}-playoff-el' => 'Europa League Finals',
26
+ },
27
+ season: ->( season ) {
28
+ case season
29
+ when Season('2020') then [1] # just getting started
30
+ when Season('2019') then [1,2,3,4]
31
+ end
32
+ }
33
+ },
34
+
35
+ # /den-superliga-2020-2021/
36
+ # /den-superliga-2019-2020-meisterschaft/
37
+ # /den-superliga-2019-2020-abstieg/
38
+ # /den-superliga-2019-2020-europa-league/
39
+ 'dk.1' => {
40
+ pages: {
41
+ 'den-superliga-{season}' => 'Regular Season',
42
+ 'den-superliga-{season}-meisterschaft' => 'Playoffs - Championship',
43
+ 'den-superliga-{season}-abstieg' => 'Playoffs - Relegation',
44
+ 'den-superliga-{season}-europa-league' => 'Europa League Finals',
45
+ },
46
+ season: ->( season ) {
47
+ case season
48
+ when Season('2020/21') then [1] # just getting started
49
+ when Season('2019/20') then [1,2,3,4]
50
+ when Season('2018/19') then [1,2,3,4]
51
+ end
52
+ }
53
+ },
54
+
55
+ })
56
+
57
+ end
@@ -0,0 +1,86 @@
1
+
2
+ module Worldfootball
3
+
4
+ LEAGUES_EUROPE.merge!({
5
+
6
+ # /ita-serie-a-2019-2020/
7
+ # /ita-serie-b-2020-2021/
8
+ 'it.1' => { pages: 'ita-serie-a' },
9
+ 'it.2' => { pages: 'ita-serie-b' },
10
+
11
+ # /por-primeira-liga-2019-2020/
12
+ # por-primeira-liga-2020-2021
13
+ # por-primeira-liga-2019-2020
14
+ # por-primeira-liga-2018-2019
15
+ # por-primeira-liga-2017-2018
16
+ # por-primeira-liga-2016-2017
17
+ # por-primeira-liga-2015-2016
18
+ # por-primeira-liga-2014-2015
19
+ # por-primeira-liga-2013-2014
20
+ # por-liga-zon-sagres-2012-2013
21
+ # por-liga-zon-sagres-2011-2012
22
+ # por-liga-sagres-2010-2011
23
+ # ...
24
+ # /por-segunda-liga-2019-2020/
25
+ # note: Sponsorship names for seasons
26
+ # 2002–2005: SuperLiga GalpEnergia
27
+ # 2005–2006: Liga betandwin.com
28
+ # 2006–2008: BWINLIGA
29
+ # 2008–2010: Liga Sagres
30
+ # 2010–2014: Liga ZON Sagres
31
+ # 2014–2020: Liga NOS
32
+ 'pt.1' => {
33
+ pages: ['por-primeira-liga',
34
+ 'por-liga-zon-sagres',
35
+ 'por-liga-sagres'
36
+ ],
37
+ season: ->( season ) {
38
+ case season
39
+ when Season('2013/14')..Season('2020/21') then 1
40
+ when Season('2011/12')..Season('2012/13') then 2
41
+ when Season('2010/11') then 3
42
+ end
43
+ },
44
+ },
45
+ 'pt.2' => { pages: 'por-segunda-liga' },
46
+
47
+ # /esp-primera-division-2019-2020/
48
+ 'es.1' => { pages: 'esp-primera-division' },
49
+ 'es.2' => { pages: 'esp-segunda-division' },
50
+
51
+ # /tur-sueperlig-2020-2021/
52
+ 'tr.1' => { pages: 'tur-sueperlig' },
53
+ 'tr.2' => { pages: 'tur-1-lig' },
54
+
55
+
56
+ # /gre-super-league-2020-2021/
57
+ 'gr.1' => {
58
+ pages: {
59
+ ## note: change from superleague to super-league !!!
60
+ 'gre-super-league' => 'Regular Season',
61
+ 'gre-super-league-{season}-meisterschaft' => 'Playoffs - Championship',
62
+ 'gre-super-league-{season}-abstieg' => 'Playoffs - Relegation',
63
+ 'gre-superleague' => 'Regular Season',
64
+ 'gre-superleague-{end_year}-playoffs' => 'Playoffs',
65
+ 'gre-superleague-{end_year}-spiel-um-platz-6' => 'Match 6th Place',
66
+ },
67
+ season: ->( season ) {
68
+ case season
69
+ when Season('2020/21') then [1] ## just getting started
70
+ when Season('2019/20') then [4,2,3]
71
+ when Season('2017/18')..Season('2018/19') then 4
72
+ when Season('2013/14')..Season('2016/17') then [4,5]
73
+ when Season('2012/13') then [4,5,6]
74
+ when Season('2010/11')..Season('2011/12') then [4,5]
75
+ end
76
+ },
77
+ },
78
+
79
+
80
+ ## todo/check: add europe southeastern or balkans - why? why not?
81
+ # e.g. /cro-1-hnl-2020-2021/
82
+ 'hr.1' => { pages: 'cro-1-hnl' },
83
+
84
+ })
85
+
86
+ end
@@ -0,0 +1,38 @@
1
+
2
+ module Worldfootball
3
+
4
+ LEAGUES_EUROPE.merge!({
5
+ 'fr.1' => { pages: 'fra-ligue-1' },
6
+ 'fr.2' => { pages: 'fra-ligue-2' },
7
+
8
+ # e.g. /lux-nationaldivision-2020-2021/
9
+ 'lu.1' => { pages: 'lux-nationaldivision' },
10
+
11
+ # e.g. /ned-eredivisie-2020-2021/
12
+ 'nl.1' => { pages: 'ned-eredivisie' },
13
+ # Championship play-offs
14
+ # Europa League play-offs (Group A + Group B / Finals )
15
+
16
+ # e.g. /bel-eerste-klasse-a-2020-2021/
17
+ # /bel-europa-league-playoffs-2018-2019-playoff/
18
+ # - Halbfinale
19
+ # - Finale
20
+ 'be.1' => {
21
+ pages: {
22
+ 'bel-eerste-klasse-a-{season}' => 'Regular Season',
23
+ 'bel-eerste-klasse-a-{season}-playoff-i' => 'Playoffs - Championship',
24
+ 'bel-europa-league-playoffs-{season}' => 'Playoffs - Europa League', ## note: missing groups (A & B)
25
+ 'bel-europa-league-playoffs-{season}-playoff' => 'Playoffs - Europa League - Finals',
26
+ },
27
+ season: ->( season ) {
28
+ case season
29
+ when Season('2020/21') then [1] # just getting started
30
+ when Season('2019/20') then [1] # covid-19 - no championship & europa
31
+ when Season('2018/19') then [1,2,3,4]
32
+ end
33
+ }
34
+ },
35
+
36
+ })
37
+
38
+ end
@@ -0,0 +1,13 @@
1
+
2
+ module Worldfootball
3
+ LEAGUES_EUROPE = {}
4
+ end
5
+
6
+
7
+ require_relative 'europe--western'
8
+ require_relative 'europe--british_isles'
9
+ require_relative 'europe--northern'
10
+ require_relative 'europe--central'
11
+ require_relative 'europe--eastern'
12
+ require_relative 'europe--southern'
13
+
@@ -0,0 +1,44 @@
1
+ module Worldfootball
2
+
3
+ LEAGUES_NORTH_AMERICA = {
4
+
5
+ # todo/fix: adjust date/time by -6 or 7 hours!!!
6
+ # /can-canadian-championship-2020/
7
+ # - Qual. 1. Runde
8
+ # - Qual. 2. Runde
9
+ # - Qual. 3. Runde
10
+ # todo/fix: check for leagues - premier league? championship? soccer league?
11
+ # 'ca.1' => { slug: 'can-canadian-championship' },
12
+
13
+
14
+
15
+ # todo/fix: adjust date/time by -7 hours!!!
16
+ ## e.g. 25.07.2020 02:30 => 24.07.2020 19.30
17
+ # 11.01.2020 04:00 => 10.01.2020 21.00
18
+ #
19
+ # e.g. /mex-primera-division-2020-2021-apertura/
20
+ # /mex-primera-division-2019-2020-clausura/
21
+ # /mex-primera-division-2019-2020-apertura-playoffs/
22
+ # - Viertelfinale
23
+ # - Halbfinale
24
+ # - Finale
25
+ # /mex-primera-division-2018-2019-clausura-playoffs/
26
+ 'mx.1' => {
27
+ pages: {
28
+ 'mex-primera-division-{season}-apertura' => 'Apertura', # 1
29
+ 'mex-primera-division-{season}-apertura-playoffs' => 'Apertura - Liguilla', # 2
30
+ 'mex-primera-division-{season}-clausura' => 'Clausura', # 3
31
+ 'mex-primera-division-{season}-clausura-playoffs' => 'Clausura - Liguilla', # 4
32
+ },
33
+ season: ->( season ) {
34
+ case season
35
+ when Season('2020/21') then [1] # just getting started
36
+ when Season('2019/20') then [1,2,3] # covid-19 - no liguilla
37
+ when Season('2010/11')..Season('2018/19') then [1,2,3,4]
38
+ end
39
+ }
40
+ },
41
+ }
42
+
43
+ end # module Worldfootball
44
+