play_scrape 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 +4 -4
- data/lib/play_scrape/app.rb +1 -1
- data/lib/play_scrape/version.rb +1 -1
- data/lib/play_scrape.rb +3 -0
- data/test/play_scrape_test.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db0c57695c095a230aa69247d7c7304ace70d017
|
4
|
+
data.tar.gz: 70f62dd285d7fce07e36b85028e0e1badf97bd0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a2c4bd003c261a2f74dde1f63ee9725b04771effcbb5d83a02cdcf5aa3f2ff716dc32695c961f28b2a6883d7e956e8bc9c384199880449f08686a44b78aed0
|
7
|
+
data.tar.gz: 86d82509d3c818026f311b0f1f21ee7a8678d59dd79ef41c26f72261c6b76a740323bd7fcb7e2de1a50e8d68d88f83210073f9e0b3dd3bf53a63c9208e06afef
|
data/lib/play_scrape/app.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module PlayScrape
|
2
2
|
class AppInfo
|
3
|
-
attr_accessor :package_name, :description, :rating, :num_ratings, :dev_url, :icon_url,
|
3
|
+
attr_accessor :app_name, :package_name, :description, :rating, :num_ratings, :dev_url, :icon_url,
|
4
4
|
:min_installs, :max_installs
|
5
5
|
|
6
6
|
def initialize
|
data/lib/play_scrape/version.rb
CHANGED
data/lib/play_scrape.rb
CHANGED
@@ -14,6 +14,7 @@ module PlayScrape
|
|
14
14
|
APP_NUM_RATINGS_CSS_PATH = 'span.reviews-num'
|
15
15
|
APP_DEV_URL_CSS_PATH = 'a.dev-link'
|
16
16
|
APP_INSTALL_CSS_PATH = 'div.details-section div.details-section-contents div.meta-info div.content'
|
17
|
+
APP_NAME_CSS_PATH = 'div.details-wrapper div.details-info div.info-container div.document-title div'
|
17
18
|
|
18
19
|
|
19
20
|
# Returns @app_info of AppInfo class
|
@@ -23,6 +24,7 @@ module PlayScrape
|
|
23
24
|
if res.code == 200
|
24
25
|
app_info = PlayScrape::AppInfo.new
|
25
26
|
html = Nokogiri::HTML(res.body)
|
27
|
+
name = html.css(APP_NAME_CSS_PATH).first
|
26
28
|
description = html.css(APP_DESC_CSS_PATH).first
|
27
29
|
app_rating = html.css(APP_RATING_CSS_PATH).first
|
28
30
|
num_ratings = html.css(APP_NUM_RATINGS_CSS_PATH).first
|
@@ -38,6 +40,7 @@ module PlayScrape
|
|
38
40
|
dev_url = dev_links.first.attributes['href'].value.match(regex)[1]
|
39
41
|
end
|
40
42
|
|
43
|
+
app_info.app_name = name.text
|
41
44
|
app_info.package_name = package_name
|
42
45
|
app_info.description = description.inner_html
|
43
46
|
app_info.rating = app_rating.text.to_f
|
data/test/play_scrape_test.rb
CHANGED
@@ -6,6 +6,8 @@ class PlayScrapeTest < Test::Unit::TestCase
|
|
6
6
|
def test_scraping_app_information
|
7
7
|
app_info = PlayScrape.scrape_app_info(TEST_PACKAGE)
|
8
8
|
|
9
|
+
|
10
|
+
assert_equal 'FIFA 14 by EA SPORTS™', app_info.app_name
|
9
11
|
assert_equal 'com.ea.game.fifa14_na', app_info.package_name, "Package name does not match"
|
10
12
|
assert_equal 4.6, app_info.rating, "Play rating does not match"
|
11
13
|
assert_equal 500000, app_info.min_installs
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: play_scrape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Villena
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|