scraper_app_store 0.0.1 → 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: c27450354925c4a3d2f82df79fc7676714e25616
4
- data.tar.gz: a58695c410a6749d05b709e052f47369b426c44e
3
+ metadata.gz: 59b839e5813c839f4289c62fc8d1f4bb1d77d854
4
+ data.tar.gz: 464c4138133d100f16d2af648f064c3a80baeea5
5
5
  SHA512:
6
- metadata.gz: 41c8068ae4f38044cdda1c4968892ce4e978ac80301d4d67a177568109afdee65b4fdf7dbfd98b69e35f9505f0aa03efef316bc8b3e0b82927a8c660dc96cd8b
7
- data.tar.gz: 23b9d0b3d6dd300948c0ce59c74597bfa227c9b8f0546aa5261b5e1501a099841a88bbc3ff9599d8738cc97d18d02e228028e22a7771556e6d1ad7436b1d9a62
6
+ metadata.gz: 48092902a767a81212bf823de3634e24188b7f8145c89d777046a88eacdeb234051d51cf7315a8132a40d4981b06b9aaf5888fde8fa81ac3b03afec76176a272
7
+ data.tar.gz: 430e7c965bd35e8bdea81c1a1165fbac1db073939fd9a843d42913f8d83bb9a81478d7b409b0a0e9233c95ede0aada90443e803f48d55b5eb1f5f26ac86a86bf
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -1,11 +1,12 @@
1
-
2
1
  module ScraperAppStore
3
-
2
+ def self.lorem
3
+ "lorem"
4
+ end
4
5
  end
5
6
 
6
- require "scraper_app_store/version"
7
7
  require "mechanize"
8
+ require "scraper_app_store/version"
9
+ require "scraper_app_store/constants"
8
10
  require "scraper_app_store/base"
9
11
  require "scraper_app_store/app"
10
12
  require "scraper_app_store/list"
11
- require "scraper_app_store/constants"
@@ -0,0 +1,48 @@
1
+ class ScraperAppStore::App < ScraperAppStore::Base
2
+ DEFAULT_URL = "https://itunes.apple.com/lookup"
3
+
4
+ def initialize( options = {} ) #params id or app_id
5
+ raise "require Id (TrackId) or AppId (bundleId) " unless options[:id] || options[:app_id]
6
+ id_field = options[:id] ? "id" : "bundleId"
7
+ id_value = options[:id] || options[:app_id]
8
+ country = options[:country] || ''
9
+
10
+ @agent = Mechanize.new
11
+
12
+ unless exist?("#{DEFAULT_URL}?#{id_field}=#{id_value}&country=#{country}")
13
+ @page = nil
14
+ else
15
+ @page = @agent.get("#{DEFAULT_URL}?#{id_field}=#{id_value}&country=#{country}")
16
+ end
17
+
18
+ @info = @page.body
19
+ end
20
+
21
+ def info
22
+ hash_info = JSON.parse(@info)["results"][0]
23
+
24
+ @app_info = {
25
+ id: hash_info['trackId'],
26
+ app_id: hash_info['bundleId'],
27
+ name: hash_info["trackName"] ,
28
+ logo: hash_info['artworkUrl512'] || hash_info['artworkUrl100'] || hash_info['artworkUrl60'],
29
+ screen_shots: hash_info['screenshotUrls'],
30
+ developer: hash_info['artistName'],
31
+ address: "",
32
+ email: hash_info['sellerUrl'],
33
+ title: hash_info["trackName"],
34
+ genre_text: hash_info['genres'],
35
+ genre_id: hash_info['genresIds'],
36
+ version: hash_info['version'],
37
+ description: hash_info['description'],
38
+ android_version_text: "",
39
+ android_version: hash_info['minimumOsVersion'],
40
+ contentRating: hash_info['contentAdvisoryRating'],
41
+ size: hash_info['fileSizeBytes'],
42
+ video: "",
43
+ score: hash_info['averageUserRating'],
44
+ }
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,14 @@
1
+ class ScraperAppStore::Base
2
+ def exist?(url)
3
+ uri = URI("#{url}")
4
+ status_code = Net::HTTP.get_response(uri).code
5
+ case status_code
6
+ when '200'
7
+ return true
8
+ when '404'
9
+ return false
10
+ else
11
+ return false
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,218 @@
1
+ module ScraperAppStore
2
+ Collection = {
3
+ TOP_MAC: 'topmacapps',
4
+ TOP_FREE_MAC: 'topfreemacapps',
5
+ TOP_GROSSING_MAC: 'topgrossingmacapps',
6
+ TOP_PAID_MAC: 'toppaidmacapps',
7
+ NEW_IOS: 'newapplications',
8
+ NEW_FREE_IOS: 'newfreeapplications',
9
+ NEW_PAID_IOS: 'newpaidapplications',
10
+ TOP_FREE_IOS: 'topfreeapplications',
11
+ TOP_FREE_IPAD: 'topfreeipadapplications',
12
+ TOP_GROSSING_IOS: 'topgrossingapplications',
13
+ TOP_GROSSING_IPAD: 'topgrossingipadapplications',
14
+ TOP_PAID_IOS: 'toppaidapplications',
15
+ TOP_PAID_IPAD: 'toppaidipadapplications'
16
+ }
17
+
18
+ Category = {
19
+ BOOKS: 6018,
20
+ BUSINESS: 6000,
21
+ CATALOGS: 6022,
22
+ EDUCATION: 6017,
23
+ ENTERTAINMENT: 6016,
24
+ FINANCE: 6015,
25
+ FOOD_AND_DRINK: 6023,
26
+ GAMES: 6014,
27
+ GAMES_ACTION: 7001,
28
+ GAMES_ADVENTURE: 7002,
29
+ GAMES_ARCADE: 7003,
30
+ GAMES_BOARD: 7004,
31
+ GAMES_CARD: 7005,
32
+ GAMES_CASINO: 7006,
33
+ GAMES_DICE: 7007,
34
+ GAMES_EDUCATIONAL: 7008,
35
+ GAMES_FAMILY: 7009,
36
+ GAMES_MUSIC: 7011,
37
+ GAMES_PUZZLE: 7012,
38
+ GAMES_RACING: 7013,
39
+ GAMES_ROLE_PLAYING: 7014,
40
+ GAMES_SIMULATION: 7015,
41
+ GAMES_SPORTS: 7016,
42
+ GAMES_STRATEGY: 7017,
43
+ GAMES_TRIVIA: 7018,
44
+ GAMES_WORD: 7019,
45
+ HEALTH_AND_FITNESS: 6013,
46
+ LIFESTYLE: 6012,
47
+ MAGAZINES_AND_NEWSPAPERS: 6021,
48
+ MAGAZINES_ARTS: 13007,
49
+ MAGAZINES_AUTOMOTIVE: 13006,
50
+ MAGAZINES_WEDDINGS: 13008,
51
+ MAGAZINES_BUSINESS: 13009,
52
+ MAGAZINES_CHILDREN: 13010,
53
+ MAGAZINES_COMPUTER: 13011,
54
+ MAGAZINES_FOOD: 13012,
55
+ MAGAZINES_CRAFTS: 13013,
56
+ MAGAZINES_ELECTRONICS: 13014,
57
+ MAGAZINES_ENTERTAINMENT: 13015,
58
+ MAGAZINES_FASHION: 13002,
59
+ MAGAZINES_HEALTH: 13017,
60
+ MAGAZINES_HISTORY: 13018,
61
+ MAGAZINES_HOME: 13003,
62
+ MAGAZINES_LITERARY: 13019,
63
+ MAGAZINES_MEN: 13020,
64
+ MAGAZINES_MOVIES_AND_MUSIC: 13021,
65
+ MAGAZINES_POLITICS: 13001,
66
+ MAGAZINES_OUTDOORS: 13004,
67
+ MAGAZINES_FAMILY: 13023,
68
+ MAGAZINES_PETS: 13024,
69
+ MAGAZINES_PROFESSIONAL: 13025,
70
+ MAGAZINES_REGIONAL: 13026,
71
+ MAGAZINES_SCIENCE: 13027,
72
+ MAGAZINES_SPORTS: 13005,
73
+ MAGAZINES_TEENS: 13028,
74
+ MAGAZINES_TRAVEL: 13029,
75
+ MAGAZINES_WOMEN: 13030,
76
+ MEDICAL: 6020,
77
+ MUSIC: 6011,
78
+ NAVIGATION: 6010,
79
+ NEWS: 6009,
80
+ PHOTO_AND_VIDEO: 6008,
81
+ PRODUCTIVITY: 6007,
82
+ REFERENCE: 6006,
83
+ SHOPPING: 6024,
84
+ SOCIAL_NETWORKING: 6005,
85
+ SPORTS: 6004,
86
+ TRAVEL: 6003,
87
+ UTILITIES: 6002,
88
+ WEATHER: 6001
89
+ }
90
+
91
+ Device = {
92
+ IPAD: 'iPadSoftware',
93
+ MAC: 'macSoftware',
94
+ ALL: 'software'
95
+ }
96
+
97
+ Sort = {
98
+ RECENT: 'mostRecent',
99
+ HELPFUL: 'mostHelpful'
100
+ }
101
+
102
+ Markets = {
103
+ DZ: 143563,
104
+ AO: 143564,
105
+ AI: 143538,
106
+ AR: 143505,
107
+ AM: 143524,
108
+ AU: 143460,
109
+ AT: 143445,
110
+ AZ: 143568,
111
+ BH: 143559,
112
+ BB: 143541,
113
+ BY: 143565,
114
+ BE: 143446,
115
+ BZ: 143555,
116
+ BM: 143542,
117
+ BO: 143556,
118
+ BW: 143525,
119
+ BR: 143503,
120
+ VG: 143543,
121
+ BN: 143560,
122
+ BG: 143526,
123
+ CA: 143455,
124
+ KY: 143544,
125
+ CL: 143483,
126
+ CN: 143465,
127
+ CO: 143501,
128
+ CR: 143495,
129
+ HR: 143494,
130
+ CY: 143557,
131
+ CZ: 143489,
132
+ DK: 143458,
133
+ DM: 143545,
134
+ EC: 143509,
135
+ EG: 143516,
136
+ SV: 143506,
137
+ EE: 143518,
138
+ FI: 143447,
139
+ FR: 143442,
140
+ DE: 143443,
141
+ GH: 143573,
142
+ GR: 143448,
143
+ GD: 143546,
144
+ GT: 143504,
145
+ GY: 143553,
146
+ HN: 143510,
147
+ HK: 143463,
148
+ HU: 143482,
149
+ IS: 143558,
150
+ IN: 143467,
151
+ ID: 143476,
152
+ IE: 143449,
153
+ IL: 143491,
154
+ IT: 143450,
155
+ JM: 143511,
156
+ JP: 143462,
157
+ JO: 143528,
158
+ KE: 143529,
159
+ KW: 143493,
160
+ LV: 143519,
161
+ LB: 143497,
162
+ LT: 143520,
163
+ LU: 143451,
164
+ MO: 143515,
165
+ MK: 143530,
166
+ MG: 143531,
167
+ MY: 143473,
168
+ ML: 143532,
169
+ MT: 143521,
170
+ MU: 143533,
171
+ MX: 143468,
172
+ MS: 143547,
173
+ NP: 143484,
174
+ NL: 143452,
175
+ NZ: 143461,
176
+ NI: 143512,
177
+ NE: 143534,
178
+ NG: 143561,
179
+ NO: 143457,
180
+ OM: 143562,
181
+ PK: 143477,
182
+ PA: 143485,
183
+ PY: 143513,
184
+ PE: 143507,
185
+ PH: 143474,
186
+ PL: 143478,
187
+ PT: 143453,
188
+ QA: 143498,
189
+ RO: 143487,
190
+ RU: 143469,
191
+ SA: 143479,
192
+ SN: 143535,
193
+ SG: 143464,
194
+ SK: 143496,
195
+ SI: 143499,
196
+ ZA: 143472,
197
+ ES: 143454,
198
+ LK: 143486,
199
+ SR: 143554,
200
+ SE: 143456,
201
+ CH: 143459,
202
+ TW: 143470,
203
+ TZ: 143572,
204
+ TH: 143475,
205
+ TN: 143536,
206
+ TR: 143480,
207
+ UG: 143537,
208
+ UA: 143492,
209
+ AE: 143481,
210
+ US: 143441,
211
+ UY: 143514,
212
+ UZ: 143566,
213
+ VE: 143502,
214
+ VN: 143471,
215
+ YE: 143571
216
+ }
217
+
218
+ end
@@ -0,0 +1,21 @@
1
+ class ScraperAppStore::List < ScraperAppStore::Base
2
+ DEFAULT_URL = "https://itunes.apple.com/${opts.country}/rss/"#${opts.collection}/limit=${opts.num}${category}/json"
3
+
4
+ def initialize(collection, category = "", num = 50, opts = {})
5
+ @agent = Mechanize.new
6
+ category = "/genre=#{category}" if category != ""
7
+ opts[:country] ||= 'us'
8
+ @page = @agent.get("https://itunes.apple.com/#{opts[:country]}/rss/#{collection}/limit=#{num}#{category}/json")
9
+ @result = JSON.parse @page.body
10
+ end
11
+
12
+ def apps
13
+ list_apps = []
14
+ list = @result["feed"]["entry"]
15
+ list.each do |item|
16
+ list_apps << item["id"]["attributes"]["im:bundleId"]
17
+ end
18
+ list_apps
19
+ end
20
+
21
+ end
@@ -1,3 +1,3 @@
1
1
  module ScraperAppStore
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scraper_app_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Bach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,10 @@ files:
66
66
  - bin/console
67
67
  - bin/setup
68
68
  - lib/scraper_app_store.rb
69
+ - lib/scraper_app_store/app.rb
70
+ - lib/scraper_app_store/base.rb
71
+ - lib/scraper_app_store/constants.rb
72
+ - lib/scraper_app_store/list.rb
69
73
  - lib/scraper_app_store/version.rb
70
74
  - scraper_app_store.gemspec
71
75
  homepage: https://github.com/anhdayem818/scraper_apple_store