sutazekarate 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sutazekarate/competition.rb +37 -0
- data/lib/sutazekarate/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4caf8697bf7ba6bfa70a5ea0311069bbc5fe1e0063c176e5f62a92040574280e
|
4
|
+
data.tar.gz: 96755e454433675a5f74296bd5e25e4c576ca244cdfe2087ba444ddde1aa0cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d75859d0a13c4a56230ce20753545e3cffe38480d9a195e40f87f9274dc63ac7018cd6e76c333dad7264f11a5553fb8345737eaa65dbc4a5b447046a4f08430d
|
7
|
+
data.tar.gz: abd7ede1653478ed7ccc13354868269707dc5e3a399d0f53e2bb960b3d5ad2839a6ceaeeb016b971f3838bdfa4193e76d95c07b1790b6ec374ee088a510a9c07
|
@@ -20,6 +20,7 @@ module Sutazekarate
|
|
20
20
|
attribute :note
|
21
21
|
attribute :registration_starts_at
|
22
22
|
attribute :registration_ends_at
|
23
|
+
attribute :attachments
|
23
24
|
|
24
25
|
def categories
|
25
26
|
@categories ||= begin
|
@@ -55,6 +56,42 @@ module Sutazekarate
|
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
59
|
+
def self.find(id)
|
60
|
+
logger.debug("Fetching competition with id #{id}")
|
61
|
+
|
62
|
+
response = HTTP.get("https://www.sutazekarate.sk/sutaze_sutazinf.php?sutaz=#{id}")
|
63
|
+
html = Nokogiri::HTML5.fragment(response.body.to_s)
|
64
|
+
|
65
|
+
name = html.search('h3.section-title-inner').text.strip.rpartition(' - ').first
|
66
|
+
club = html.search('.table1 tr:nth-child(1) td:nth-child(2)').text.strip
|
67
|
+
|
68
|
+
starts_at = Date.parse(html.search('.table1 tr:nth-child(2) td:nth-child(2)').text.strip)
|
69
|
+
|
70
|
+
registration_info = html.search('.table1 tr:nth-child(4) td:nth-child(2)').text.strip
|
71
|
+
registration_starts_at, registration_ends_at = registration_info.split(' - ').map do |date|
|
72
|
+
Date.parse(date)
|
73
|
+
end
|
74
|
+
|
75
|
+
attachments = html.search('.table1 tr').reduce([]) do |acc, row|
|
76
|
+
acc += row.search('td:nth-child(2) a[target="_blank"]').map do |a|
|
77
|
+
"https://www.sutazekarate.sk/#{a.attr('href')}"
|
78
|
+
end
|
79
|
+
.grep_v(/\.php/)
|
80
|
+
|
81
|
+
acc
|
82
|
+
end
|
83
|
+
|
84
|
+
Competition.new(
|
85
|
+
id:,
|
86
|
+
starts_at:,
|
87
|
+
name:,
|
88
|
+
club:,
|
89
|
+
registration_starts_at:,
|
90
|
+
registration_ends_at:,
|
91
|
+
attachments:,
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
58
95
|
def self.all(year: Date.today.year)
|
59
96
|
logger.debug("Fetching competitions for year #{year}")
|
60
97
|
response = HTTP.get("https://www.sutazekarate.sk/ajax/av_sutaze.php?lang=sk&r=#{year}&sort=datum&order=desc&limit=1000&offset=0")
|
data/lib/sutazekarate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sutazekarate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmed Al Hafoudh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.5.
|
153
|
+
rubygems_version: 3.5.23
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Web scraper for www.sutazekarate.sk
|