google-player 0.0.2 → 0.0.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
  SHA1:
3
- metadata.gz: 533cb88dfa418ac10bee8b337d434c4067a0e48e
4
- data.tar.gz: 94390bf6b7d5c6c7a67531213903f16362732773
3
+ metadata.gz: d3e7c61a14a0d26c5529338415727afb435efe54
4
+ data.tar.gz: a19250923ad41ab83d23f384170b3759049a62c5
5
5
  SHA512:
6
- metadata.gz: f6aafb99cb34f736f65e7e65dbad14e89293dccd92f57df11c3caaaff0758ff6982acd485dac650c824c4327e9acff2f4e4599c5d23153c157573efe21c27fb9
7
- data.tar.gz: 93262bb3f31663a0f607a749b0a5c59d7c967f76b6e1754c5ae0ff23754d8e89cd7e916853dde5a57a4267ca2861eaad5e1169d7133ee28b050bb7e7ed2385f2
6
+ metadata.gz: 910df457bb2cb49b79634e6cab1eabcdafe6324c5e8bafe7a17ddec61e05a2a926011f4bd8d5727627882c7a38b87ec36947c85b955098cec72bec44c0054c85
7
+ data.tar.gz: 9a0798999d959151ca641189234048093e953f4bf01c35dbac2956474a175bd83084370119465da37bb57a8378bfdf1272da9cc57f1f14c785afcea9b1a1ff29
@@ -14,7 +14,7 @@ class GooglePlay
14
14
  :rating_count => parse_app_rating_count(doc),
15
15
  :rating_counts => parse_app_rating_counts(doc),
16
16
  :rating_average => parse_app_rating_average(doc),
17
- :description => parse_app_descrption(doc),
17
+ :description => parse_app_description(doc),
18
18
  :recent_change => parse_app_recent_change(doc),
19
19
  :last_update => parse_app_last_update(doc),
20
20
  :file_size => parse_app_file_size(doc),
@@ -47,18 +47,22 @@ class GooglePlay
47
47
 
48
48
  def parse_review_user(node)
49
49
  a = node.xpath(".//span[@class='author-name']/a").first
50
- a.nil? ? '' : a['title']
50
+ a.nil? ? '' : a.text
51
51
  end
52
52
 
53
53
  def parse_review_user_id(node)
54
54
  a = node.xpath(".//span[@class='author-name']/a").first
55
- a.nil? ? nil : a['data-userid']
55
+ a.nil? ? nil : a['href'].match(/id=(\w+)/)[1].to_i
56
56
  end
57
57
 
58
58
  def parse_review_date(node)
59
59
  text = node.xpath(".//span[@class='review-date']").text
60
- text =~ /(\d+)\D+(\d+)\D+(\d+)/
61
- Date.new($1.to_i, $2.to_i, $3.to_i)
60
+ begin
61
+ Date.parse(text)
62
+ rescue
63
+ text =~ /(\d+)\D+(\d+)\D+(\d+)/
64
+ Date.new($1.to_i, $2.to_i, $3.to_i)
65
+ end
62
66
  end
63
67
 
64
68
  def parse_review_rating(node)
@@ -87,7 +91,7 @@ class GooglePlay
87
91
  end
88
92
 
89
93
  def parse_app_developer(node)
90
- node.xpath("//div[@itemprop='author']/a[@itemprop='name']").text
94
+ node.xpath("//a[@class='document-subtitle primary']/span[@itemprop='name']").text
91
95
  end
92
96
 
93
97
  def parse_app_developer_web(node)
@@ -121,8 +125,8 @@ class GooglePlay
121
125
  node.xpath("//div[@class='score']").text.to_f
122
126
  end
123
127
 
124
- def parse_app_descrption(node)
125
- node.xpath("//div[@class='app-orig-desc']").inner_html
128
+ def parse_app_description(node)
129
+ node.xpath("//div[@class='id-app-orig-desc']").inner_html
126
130
  end
127
131
 
128
132
  def parse_app_recent_change(node)
@@ -133,8 +137,12 @@ class GooglePlay
133
137
 
134
138
  def parse_app_last_update(node)
135
139
  text = node.xpath("//div[@itemprop='datePublished']").text
136
- text =~ /(\d+)\D+(\d+)\D+(\d+)/
137
- Date.new($1.to_i, $2.to_i, $3.to_i)
140
+ begin
141
+ Date.parse(text)
142
+ rescue
143
+ text =~ /(\d+)\D+(\d+)\D+(\d+)/
144
+ Date.new($1.to_i, $2.to_i, $3.to_i)
145
+ end
138
146
  end
139
147
 
140
148
  def parse_app_file_size(node)
@@ -1,3 +1,3 @@
1
1
  class GooglePlay
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-player
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mako2x
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.2.2
121
+ rubygems_version: 2.4.5.1
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Fetchs app info and reviews from Google Play.