itch_client 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +6 -3
- data/lib/itch/rewards.rb +9 -4
- data/lib/itch/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: 28084bebc328044fc8928868f6f60a44440709a1418068f64163472cc638b50a
|
4
|
+
data.tar.gz: 4cffdcd95aaf7f96e97f06ad805f6bf33b60d10e4ccde3e441f9221ca7c91dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94cdc6fafba609a95616b19fed6e372d47c75e40165fd6eed4c29383e2595bd04adb565f843ea51f36d869ed166bbabe93ef8d71d0876183288317c42c521a4
|
7
|
+
data.tar.gz: 144073e53b7209396d2fffb132cdfb27c7bd7648ffe545cfa6eecfd06a2c0ac4c82da5638538b5fb71fef739a6a124398c276ef67bd606a2e60b1049fa33919a
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
itch_client (0.4.
|
4
|
+
itch_client (0.4.1)
|
5
5
|
mechanize (~> 2.8)
|
6
6
|
|
7
7
|
GEM
|
@@ -35,10 +35,12 @@ GEM
|
|
35
35
|
mime-types (3.4.1)
|
36
36
|
mime-types-data (~> 3.2015)
|
37
37
|
mime-types-data (3.2022.0105)
|
38
|
+
mini_portile2 (2.8.0)
|
38
39
|
net-http-digest_auth (1.4.1)
|
39
40
|
net-http-persistent (4.0.1)
|
40
41
|
connection_pool (~> 2.2)
|
41
|
-
nokogiri (1.13.
|
42
|
+
nokogiri (1.13.6)
|
43
|
+
mini_portile2 (~> 2.8.0)
|
42
44
|
racc (~> 1.4)
|
43
45
|
parallel (1.22.1)
|
44
46
|
parser (3.1.1.0)
|
@@ -46,7 +48,7 @@ GEM
|
|
46
48
|
pry (0.14.1)
|
47
49
|
coderay (~> 1.1)
|
48
50
|
method_source (~> 1.0)
|
49
|
-
public_suffix (4.0.
|
51
|
+
public_suffix (4.0.7)
|
50
52
|
racc (1.6.0)
|
51
53
|
rainbow (3.1.1)
|
52
54
|
rake (13.0.6)
|
@@ -88,6 +90,7 @@ GEM
|
|
88
90
|
webrobots (0.1.2)
|
89
91
|
|
90
92
|
PLATFORMS
|
93
|
+
ruby
|
91
94
|
x86_64-linux
|
92
95
|
|
93
96
|
DEPENDENCIES
|
data/lib/itch/rewards.rb
CHANGED
@@ -15,7 +15,8 @@ module Itch
|
|
15
15
|
include RequireAuth
|
16
16
|
include Request
|
17
17
|
|
18
|
-
REWARD_DATA = /GameEdit\.EditRewards\(.*?
|
18
|
+
REWARD_DATA = /GameEdit\.EditRewards\(.*?"rewards":(\[.*?\])/.freeze
|
19
|
+
REWARD_NOUN_DATA = /GameEdit\.EditRewards\(.*?"reward_noun":"(.*?)(?<!\\)"/.freeze
|
19
20
|
|
20
21
|
def initialize(agent, game_id)
|
21
22
|
@agent = agent
|
@@ -95,10 +96,14 @@ module Itch
|
|
95
96
|
raise Error, "Could not find game id #{@game_id} rewards" unless page.code == "200"
|
96
97
|
|
97
98
|
script = page.css("script").find do |node|
|
98
|
-
node.text =~ REWARD_DATA
|
99
|
-
end
|
99
|
+
node.text =~ REWARD_DATA && node.text =~ REWARD_NOUN_DATA
|
100
|
+
end
|
101
|
+
return [] unless script
|
102
|
+
script = script.text
|
100
103
|
|
101
|
-
REWARD_DATA.match(script)[1
|
104
|
+
data = REWARD_DATA.match(script)[1]
|
105
|
+
noun = REWARD_NOUN_DATA.match(script)[1]
|
106
|
+
[data, noun]
|
102
107
|
end
|
103
108
|
|
104
109
|
def parse_row(row)
|
data/lib/itch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itch_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Billiam
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
86
|
+
rubygems_version: 3.1.6
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: Itch.io screen scraping utility
|