play_scrape 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a4ba187ad1a3d5721e9d2b2cbd8907fa978d2e7
4
- data.tar.gz: 7c333634a6266d78c7daaee8b3839d368a89ea29
3
+ metadata.gz: b4eff65a54fd0c0acee5c097b6939b3860dcf485
4
+ data.tar.gz: a93abdbbbde177255bccd722aaf18a23f3eb2339
5
5
  SHA512:
6
- metadata.gz: 0ed63e62a32758c7758a134d4c489ee6ea2173c4451cc6727d7546e2d55c58167f73abd575816b3b3306682a3561108c3224ca3c53336e9ec3a61ee8597fdf9b
7
- data.tar.gz: 4ac002943742b656332a3a3bbe35bba5267ee5486093636ec309872316b0db86658394fa7639d55228f2ac8c9848434b3b41579712903172c31a366d828ca45f
6
+ metadata.gz: 5ff45b19bc45a5732b5cacfd1ec83004e3edd20f7bd104a6c78805a8950c91d7c6598bb710a7c869cfb752a37474ec66ba26f49a2a907e3f95783685841cc45b
7
+ data.tar.gz: e212442aca5c2b36d78dd27f11e58a6764cba088f908e368e7e44bc89a89c59f4575711907ca62d451de1cc7c742257e9ce71e9e80e246fabceab30441220432
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in play_scrape.gemspec
4
4
  gemspec
5
- gem 'nokogiri', '~> 1.6.0'
6
- gem 'typhoeus', '~> 0.6.6'
@@ -1,3 +1,3 @@
1
1
  module PlayScrape
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/play_scrape.rb CHANGED
@@ -43,7 +43,7 @@ module PlayScrape
43
43
  dev_links = html.css(APP_DEV_URL_CSS_PATH)
44
44
  dev_url = ""
45
45
  if !dev_links.empty? && dev_links.first.text.match(/Visit Developer's Website/)
46
- dev_url = dev_links.first.attributes['href'].value.match(URL_REGEX)[1]
46
+ dev_url = dev_links.first.attributes['href'].value.match(URL_REGEX)[1]
47
47
  end
48
48
 
49
49
  app_info.app_name = name.text
@@ -64,4 +64,14 @@ module PlayScrape
64
64
  def self.get_html_page_for(package_name)
65
65
  res = Typhoeus.get(PLAY_URL + package_name)
66
66
  end
67
+
68
+ def self.scrape_app_icon(package_name)
69
+ res = self.get_html_page_for(package_name)
70
+ if res
71
+ html = Nokogiri::HTML(res.body)
72
+ html.css(APP_ICON_CSS_PATH).first.attributes['src'].value
73
+ else
74
+ nil
75
+ end
76
+ end
67
77
  end
data/play_scrape.gemspec CHANGED
@@ -20,4 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency "nokogiri", "~> 1.6.0"
25
+ spec.add_runtime_dependency "typhoeus", "~> 0.6.6"
23
26
  end
@@ -1,21 +1,22 @@
1
- require 'test/unit'
2
- require 'play_scrape'
1
+ require 'minitest/autorun'
2
+ require 'play_scrape'
3
3
 
4
- class PlayScrapeTest < Test::Unit::TestCase
4
+ class PlayScrapeTest < MiniTest::Unit::TestCase
5
5
  TEST_PACKAGE = 'com.ea.game.fifa14_na'
6
6
  def test_scraping_app_information
7
7
  app_info = PlayScrape.scrape_app_info(TEST_PACKAGE)
8
- puts app_info.version
9
-
10
-
11
8
  assert_equal 'FIFA 14 by EA SPORTS™', app_info.app_name
12
9
  assert_equal 'com.ea.game.fifa14_na', app_info.package_name, "Package name does not match"
13
- assert_equal 4.6, app_info.rating, "Play rating does not match"
10
+ assert_equal 4.5, app_info.rating, "Play rating does not match"
14
11
  assert_equal 1000000, app_info.min_installs
15
12
  assert_equal 5000000, app_info.max_installs
16
- assert_operator 36514, :<=, app_info.num_ratings
17
- assert_match 'REAL PLAYERS. REAL TEAMS. REAL LEAGUES.', app_info.description, "Description doesn't match"
13
+ assert_operator 194885, :<=, app_info.num_ratings
14
+ assert_match 'Now with', app_info.description, "Description doesn't match"
18
15
  assert_match 'http://help.ea.com', app_info.dev_url, "Developer url doesn't match"
19
- assert_equal '1.3.2', app_info.version
16
+ assert_equal '1.3.6', app_info.version
17
+ end
18
+
19
+ def test_getting_icon
20
+ assert_equal "https://lh5.ggpht.com/chWzyD9s4aOVlOekaQwnkVXnYOy_KQu9vZFaVuB_C2jHfORe9HBcSEk3_dfjZkmwCTY=w300", PlayScrape.scrape_app_icon(TEST_PACKAGE)
20
21
  end
21
22
  end
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.5
4
+ version: 0.0.6
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-12-18 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.6.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: typhoeus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.6
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.6
41
69
  description: Basic scraping of the Google PlayStore
42
70
  email:
43
71
  - mvillena@cmu.edu
@@ -76,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
104
  version: '0'
77
105
  requirements: []
78
106
  rubyforge_project:
79
- rubygems_version: 2.0.3
107
+ rubygems_version: 2.2.1
80
108
  signing_key:
81
109
  specification_version: 4
82
110
  summary: It can scrape the play store