itch_client 0.4.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e78c3d091abc57746fe57324e61e6328fa7194e8b50c3fde4d89426cbff9c9c4
4
- data.tar.gz: 3b2a35f25b8dc886330a3d5b7211accc8f52d75c316fe5b827e23a0f6bf20e8c
3
+ metadata.gz: 17766808c86d673c36510b4ecda35c16fd137ed08b92a41ab3be93130d171303
4
+ data.tar.gz: 757f5d1809b95cb7627b7f63a4361ef6b5a6afaed0eaa1bde473ce3065418e26
5
5
  SHA512:
6
- metadata.gz: d6aec1b9bf214ec8db6584eba3503273dfaf8b7c629c7db6214b5acfcf20b3be605b1d9bf3a125652bd919e2e9d5e55f7576967b0ae3e29986168690e686f7cf
7
- data.tar.gz: dacd4cfc500a02169a96eb984ae283bb972057f618f2b239e1a5daf45bd17d405235831fbfaaa63aa37339966c706f689a4ad2ac0091d9d6f5b21affab688dc6
6
+ metadata.gz: c2c692bebf2bcf77f93c73483bb472ef03b77574a38ed735b792155fc53f02c1d5f366d5c7014e906a777385d80e1328b958283b01a18f079d3e6c0062c98b8e
7
+ data.tar.gz: bdb70a5360dce0340b89f9ccbc6a241262074ae7954b72063658475285d59cea8acfdf15a5c1aaa2737d6ff33667ca35584fa80aa8db920eea011a37148711bf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.4.2] - 2023-04-05
2
+
3
+ - Fix reward parsing failing due to inconsistent JSON ordering
4
+
1
5
  ## [0.4.0] - 2022-04-03
2
6
 
3
7
  - Added review list
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- itch_client (0.4.1)
4
+ itch_client (0.4.3)
5
5
  mechanize (~> 2.8)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.8.0)
11
- public_suffix (>= 2.0.2, < 5.0)
10
+ addressable (2.8.5)
11
+ public_suffix (>= 2.0.2, < 6.0)
12
12
  ast (2.4.2)
13
13
  coderay (1.1.3)
14
- connection_pool (2.2.5)
14
+ connection_pool (2.4.1)
15
15
  diff-lcs (1.5.0)
16
16
  domain_name (0.5.20190701)
17
17
  unf (>= 0.0.5, < 1.0.0)
18
- http-cookie (1.0.4)
18
+ http-cookie (1.0.5)
19
19
  domain_name (~> 0.5)
20
20
  io-console (0.5.11)
21
21
  irb (1.4.1)
22
22
  reline (>= 0.3.0)
23
- mechanize (2.8.4)
23
+ mechanize (2.9.1)
24
24
  addressable (~> 2.8)
25
25
  domain_name (~> 0.5, >= 0.5.20190701)
26
26
  http-cookie (~> 1.0, >= 1.0.3)
@@ -32,15 +32,17 @@ GEM
32
32
  webrick (~> 1.7)
33
33
  webrobots (~> 0.1.2)
34
34
  method_source (1.0.0)
35
- mime-types (3.4.1)
35
+ mime-types (3.5.1)
36
36
  mime-types-data (~> 3.2015)
37
- mime-types-data (3.2022.0105)
38
- mini_portile2 (2.8.0)
37
+ mime-types-data (3.2023.0808)
38
+ mini_portile2 (2.8.4)
39
39
  net-http-digest_auth (1.4.1)
40
- net-http-persistent (4.0.1)
40
+ net-http-persistent (4.0.2)
41
41
  connection_pool (~> 2.2)
42
- nokogiri (1.13.6)
43
- mini_portile2 (~> 2.8.0)
42
+ nokogiri (1.15.4)
43
+ mini_portile2 (~> 2.8.2)
44
+ racc (~> 1.4)
45
+ nokogiri (1.15.4-x86_64-linux)
44
46
  racc (~> 1.4)
45
47
  parallel (1.22.1)
46
48
  parser (3.1.1.0)
@@ -48,8 +50,8 @@ GEM
48
50
  pry (0.14.1)
49
51
  coderay (~> 1.1)
50
52
  method_source (~> 1.0)
51
- public_suffix (4.0.7)
52
- racc (1.6.0)
53
+ public_suffix (5.0.3)
54
+ racc (1.7.1)
53
55
  rainbow (3.1.1)
54
56
  rake (13.0.6)
55
57
  regexp_parser (2.2.1)
@@ -84,9 +86,9 @@ GEM
84
86
  rubyntlm (0.6.3)
85
87
  unf (0.1.4)
86
88
  unf_ext
87
- unf_ext (0.0.8.1)
89
+ unf_ext (0.0.8.2)
88
90
  unicode-display_width (2.1.0)
89
- webrick (1.7.0)
91
+ webrick (1.8.1)
90
92
  webrobots (0.1.2)
91
93
 
92
94
  PLATFORMS
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.1"
4
+ VERSION = "0.4.3"
5
5
  end
data/lib/itch_client.rb CHANGED
@@ -33,13 +33,13 @@ module Itch
33
33
  EDIT_GAME = "https://itch.io/game/edit/%<id>d"
34
34
  GAME = "https://%<username>s.itch.io/%<slug>s"
35
35
  LOGIN = "https://itch.io/login"
36
- MONTH_PURCHASES_CSV = "https://itch.io/export-purchases/by-date/%<month>d-%<year>d"
37
- PURCHASES_CSV = "https://itch.io/export-purchases/all"
36
+ MONTH_PURCHASES_CSV = "https://itch.io/dashboard/export-purchases/by-date/%<month>d-%<year>d"
37
+ PURCHASES_CSV = "https://itch.io/dashboard/export-purchases/all"
38
38
  REVIEWS = "https://itch.io/game/ratings/%<id>d?page=%<page>d"
39
39
  REWARD_CSV = "https://itch.io/game/rewards/%<id>d/claimed?format=csv"
40
40
  REWARDS = "https://itch.io/game/rewards/%<id>d"
41
41
  TOTP_FRAGMENT = "https://itch.io/totp/verify/"
42
- YEAR_PURCHASES_CSV = "https://itch.io/export-purchases/by-date/%<year>d"
42
+ YEAR_PURCHASES_CSV = "https://itch.io/dashboard/export-purchases/by-date/%<year>d"
43
43
  end
44
44
 
45
45
  def self.new(**kwargs)
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.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billiam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2023-08-29 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.1.6
86
+ rubygems_version: 3.2.15
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Itch.io screen scraping utility