itch_client 0.4.0 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f876530a8599ff397068d9d47e2e8adc23b98fcc72408316d0115f7207302d4
4
- data.tar.gz: 3bb26a90883d227f89b07ec3f10ec4c02e207d8ebfa4ca96e630aff2ff478a7e
3
+ metadata.gz: 28084bebc328044fc8928868f6f60a44440709a1418068f64163472cc638b50a
4
+ data.tar.gz: 4cffdcd95aaf7f96e97f06ad805f6bf33b60d10e4ccde3e441f9221ca7c91dc2
5
5
  SHA512:
6
- metadata.gz: c7566cb970c91713a5c471b74a2a9d6b17d5b2fdf570976abc8b1f5b893a33fd45ca5b1160bf1f7324f49fd86eb50ebd7d1388b764c416fbb8c2d1493d7f46b9
7
- data.tar.gz: 06566e4cf0598494518ca9a1a4d0c42ddb7ee1b4b8ba03b2d8e1fd10f885f9c84c226da62d55fad4001e2dfc11448afb033ee6b3e78dc715ffebcb304d5b82c6
6
+ metadata.gz: a94cdc6fafba609a95616b19fed6e372d47c75e40165fd6eed4c29383e2595bd04adb565f843ea51f36d869ed166bbabe93ef8d71d0876183288317c42c521a4
7
+ data.tar.gz: 144073e53b7209396d2fffb132cdfb27c7bd7648ffe545cfa6eecfd06a2c0ac4c82da5638538b5fb71fef739a6a124398c276ef67bd606a2e60b1049fa33919a
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  .env
13
13
  cookies.yml
14
14
  *.gem
15
+ .tool-versions
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- itch_client (0.4.0)
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.3-x86_64-linux)
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.6)
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\(.*?(?:"rewards":(\[.*\]),)?"reward_noun":"(.*(?<!\\))"}\)/.freeze
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.text
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Itch
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
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.0
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: 2022-04-03 00:00:00.000000000 Z
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.2.15
86
+ rubygems_version: 3.1.6
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Itch.io screen scraping utility