android_market_api 0.2.0 → 0.3.0
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.
- data/README.md +49 -0
- data/lib/android_market_api/android_market.rb +50 -39
- data/lib/android_market_api/android_market_application.rb +9 -8
- data/lib/android_market_api/version.rb +1 -1
- data/test.rb +10 -5
- metadata +5 -5
- data/README +0 -10
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
Open Source Android Market Ruby Library for parsing Android Market.
|
2
|
+
|
3
|
+
This project is under development.
|
4
|
+
|
5
|
+
Fell free to clone it and submit your changes to us.
|
6
|
+
|
7
|
+
INSTALL INSTRUCTIONS
|
8
|
+
|
9
|
+
gem install android_market_api
|
10
|
+
|
11
|
+
For parsing an application on Android Market
|
12
|
+
|
13
|
+
Ex:
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'android_market_api'
|
17
|
+
|
18
|
+
$app=AndroidMarketApplication.new('com.zeptolab.ctr.paid')
|
19
|
+
$app.to_s
|
20
|
+
|
21
|
+
|
22
|
+
For getting Top Selling Paid Apps for a category
|
23
|
+
|
24
|
+
Ex:
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'android_market_api'
|
28
|
+
|
29
|
+
app_arr=AndroidMarket.get_top_selling_paid_apps('CASUAL')
|
30
|
+
app_arr[2].to_s
|
31
|
+
|
32
|
+
|
33
|
+
For getting Top Selling Free Apps for a category
|
34
|
+
|
35
|
+
Ex:
|
36
|
+
|
37
|
+
require 'rubygems'
|
38
|
+
require 'android_market_api'
|
39
|
+
|
40
|
+
app_arr=AndroidMarket.get_top_selling_free_apps('CASUAL')
|
41
|
+
app_arr[1].to_s
|
42
|
+
|
43
|
+
SOON MORE DOCUMENTATION
|
44
|
+
|
45
|
+
How can i help ?
|
46
|
+
|
47
|
+
Contributions are welcome ! The project is mainly missing documentation and examples...
|
48
|
+
|
49
|
+
|
@@ -4,58 +4,69 @@
|
|
4
4
|
# Permission is granted for use, copying, modification, distribution,
|
5
5
|
# and distribution of modified versions of this work as long as the
|
6
6
|
# above copyright notice is included.
|
7
|
+
|
7
8
|
require 'rubygems'
|
8
9
|
require 'hpricot'
|
9
10
|
require 'open-uri'
|
10
|
-
|
11
|
+
require 'android_market_api/android_market_application'
|
11
12
|
|
12
13
|
class AndroidMarket
|
13
14
|
|
14
15
|
@@game_categories=Array.[]('ARCADE','BRAIN','CARDS','CASUAL','GAME_WALLPAPER','RACING','SPORTS_GAMES','GAME_WIDGETS')
|
15
16
|
@@application_categories=Array.[]('BOOKS_AND_REFERENCE','BUSINESS','COMICS','COMMUNICATION','EDUCATION','ENTERTAINMENT','FINANCE','HEALTH_AND_FITNESS','LIBRARIES_AND_DEMO','LIFESTYLE','APP_WALLPAPER','MEDIA_AND_VIDEO','MEDICAL','MUSIC_AND_AUDIO','NEWS_AND_MAGAZINES','PERSONALIZATION','PHOTOGRAPHY','PRODUCTIVITY','SHOPPING','SOCIAL','SPORTS','TOOLS','TRANSPORTATION','TRAVEL_AND_LOCAL','WEATHER','APP_WIDGETS')
|
17
|
+
@@languages=Array.[]('en','pt_PT','pt_BR','es','es_419','fr','it','es')
|
18
|
+
|
19
|
+
def AndroidMarket.get_top_selling_free_app_in_category(category,position,language='en')
|
20
|
+
url="https://market.android.com/details?id=apps_topselling_free&cat="+category+"&start="+(position-1).to_s+"&num=24&hl="+language
|
21
|
+
doc = Hpricot(open(url,'User-Agent' => 'ruby'))
|
22
|
+
buy_div=doc.search("//div[@class='buy-border']//a").first
|
23
|
+
puts "Getting Application package "+buy_div.attributes['data-docid']
|
24
|
+
app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
|
25
|
+
return app
|
26
|
+
end
|
27
|
+
|
28
|
+
def AndroidMarket.get_top_selling_paid_app_in_category(category,position,language='en')
|
29
|
+
url="https://market.android.com/details?id=apps_topselling_paid&cat="+category+"&start="+(position-1).to_s+"&num=24&hl="+language
|
30
|
+
doc = Hpricot(open(url,'User-Agent' => 'ruby'))
|
31
|
+
buy_div=doc.search("//div[@class='buy-border']//a").first
|
32
|
+
puts "Getting Application package "+buy_div.attributes['data-docid']
|
33
|
+
app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
|
34
|
+
return app
|
35
|
+
end
|
36
|
+
|
16
37
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
puts
|
38
|
+
def AndroidMarket.get_overall_top_selling_free_app(position,language='en')
|
39
|
+
url="https://market.android.com/details?id=apps_topselling_free&start="+(position-1).to_s+"&num=24&hl="+language
|
40
|
+
doc = Hpricot(open(url,'User-Agent' => 'ruby'))
|
41
|
+
buy_div=doc.search("//div[@class='buy-border']//a").first
|
42
|
+
puts "Getting Application package "+buy_div.attributes['data-docid']
|
43
|
+
app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
|
44
|
+
return app
|
45
|
+
end
|
46
|
+
|
47
|
+
def AndroidMarket.get_overall_top_selling_paid_app(position,language='en')
|
48
|
+
#position++
|
49
|
+
url="https://market.android.com/details?id=apps_topselling_paid&start="+(position-1).to_s+"&num=24&hl="+language
|
22
50
|
doc = Hpricot(open(url,'User-Agent' => 'ruby'))
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
puts "Getting Application package "+buy_div.attributes['data-docid']
|
32
|
-
app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
|
33
|
-
apps.push(app)
|
34
|
-
#i=i+1
|
35
|
-
end
|
36
|
-
return apps
|
51
|
+
buy_div=doc.search("//div[@class='buy-border']//a").first
|
52
|
+
puts "Getting Application package "+buy_div.attributes['data-docid']
|
53
|
+
app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
|
54
|
+
return app
|
55
|
+
end
|
56
|
+
|
57
|
+
def AndroidMarket.get_languages()
|
58
|
+
return @@languages
|
37
59
|
end
|
38
60
|
|
39
|
-
|
40
|
-
|
41
|
-
apps=Array.new
|
42
|
-
url="https://market.android.com/details?id=apps_topselling_free&cat="+category+"&start="+start.to_s+"&num=24&hl="+language
|
43
|
-
doc = Hpricot(open(url,'User-Agent' => 'ruby'))
|
44
|
-
#i=1
|
45
|
-
doc.search("//div[@class='buy-border']//a").each do |buy_div|
|
46
|
-
#puts '-------------------------------------------------'
|
47
|
-
#puts "| Applicaton Ranking "+i.to_s
|
48
|
-
#puts "| Application Name = "+buy_div.attributes['data-doctitle']
|
49
|
-
#puts "| Application Package = "+buy_div.attributes['data-docid']
|
50
|
-
#puts "| Application Price = "+(buy_div.attributes['data-docpricemicros'].to_i/1000000).to_s
|
51
|
-
#puts '-------------------------------------------------'
|
52
|
-
puts "Getting Application package "+buy_div.attributes['data-docid']
|
53
|
-
app=AndroidMarketApplication.new(buy_div.attributes['data-docid'],language)
|
54
|
-
#i=i+1
|
55
|
-
apps.push(app)
|
56
|
-
end
|
57
|
-
return apps
|
61
|
+
def AndroidMarket.get_game_categories()
|
62
|
+
return @@game_categories
|
58
63
|
end
|
59
64
|
|
65
|
+
def AndroidMarket.get_application_categories()
|
66
|
+
return @@application_categories
|
67
|
+
end
|
60
68
|
end
|
61
69
|
|
70
|
+
|
71
|
+
|
72
|
+
|
@@ -4,17 +4,21 @@
|
|
4
4
|
# Permission is granted for use, copying, modification, distribution,
|
5
5
|
# and distribution of modified versions of this work as long as the
|
6
6
|
# above copyright notice is included.
|
7
|
+
|
7
8
|
require 'rubygems'
|
8
9
|
require 'open-uri'
|
9
10
|
require 'hpricot'
|
10
11
|
|
11
12
|
class AndroidMarketApplication
|
12
13
|
|
14
|
+
attr_accessor :package, :language,:name, :current_version,:price, :ratting_value,:ratting_count, :updated,:sdk_required, :category,:downloads, :size,:contentRating,:description,:screenshots,:developer_name,:icon,:update_text
|
15
|
+
|
13
16
|
@@debug=0
|
14
17
|
###########################################################################################
|
15
18
|
# Contructor: Example Usage AndroidMarketApplication.new("com.bearstouch.smsscheduler")
|
16
19
|
############################################################################################
|
17
20
|
def initialize(package,language='en')
|
21
|
+
|
18
22
|
@package=package
|
19
23
|
@language=language;
|
20
24
|
@name="" # Application Name
|
@@ -29,10 +33,8 @@ class AndroidMarketApplication
|
|
29
33
|
@size="" # Application Size
|
30
34
|
@contentRating="" # Content Ratting
|
31
35
|
@description="" # Application description
|
32
|
-
@screenshots="" # Screenshot URL Array
|
33
36
|
@developer_name="" # Developer Name
|
34
37
|
@icon="" # Icon URL
|
35
|
-
@update_text=""
|
36
38
|
@screenshots=Array.new
|
37
39
|
@update_text=Array.new
|
38
40
|
parseInAndroidMarket(language)
|
@@ -193,7 +195,9 @@ class AndroidMarketApplication
|
|
193
195
|
end
|
194
196
|
end
|
195
197
|
end
|
196
|
-
|
198
|
+
|
199
|
+
private :fill_current_version, :fill_ratting_value, :fill_ratting_count,:fill_updated_at,:fill_sdk_required,:fill_category,:fill_downloads,:fill_size,:fill_price,:fill_content_rating,:fill_application_name,:fill_description,:fill_screenshots,:fill_developer_name,:fill_icon,:fill_changed_text,:parseInAndroidMarket
|
200
|
+
|
197
201
|
def to_s()
|
198
202
|
puts "-------------------------------------------------------------"
|
199
203
|
puts " Application Name = "+@name.to_s
|
@@ -204,7 +208,7 @@ class AndroidMarketApplication
|
|
204
208
|
puts " Application Ratting Count = "+@ratting_count.to_s
|
205
209
|
puts " Application Updated = "+@updated.to_s
|
206
210
|
puts " SDK required = "+@sdk_required.to_s
|
207
|
-
|
211
|
+
puts " Category = "+@category.to_s
|
208
212
|
puts " Nr of Downloads = "+@downloads.to_s
|
209
213
|
puts " Size = "+@size.to_s
|
210
214
|
puts " Content Ratting = "+@contentRating.to_s
|
@@ -216,7 +220,4 @@ class AndroidMarketApplication
|
|
216
220
|
|
217
221
|
end
|
218
222
|
|
219
|
-
|
220
|
-
$app=AndroidMarketApplication.new('com.zeptolab.ctr.paid')
|
221
|
-
$app.to_s
|
222
|
-
puts "Ending"
|
223
|
+
|
data/test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/
|
1
|
+
#!/usr/bin/ruby
|
2
2
|
###########################################
|
3
3
|
#
|
4
4
|
# Android Market Parser
|
@@ -9,7 +9,12 @@
|
|
9
9
|
require 'rubygems'
|
10
10
|
require 'android_market_api'
|
11
11
|
|
12
|
-
puts "Starting ...."
|
13
|
-
|
14
|
-
|
15
|
-
puts "Ending"
|
12
|
+
#puts "Starting ...."
|
13
|
+
app=AndroidMarketApplication.new('com.bearstouch.smsscheduler')
|
14
|
+
app.to_s
|
15
|
+
#puts "Ending"
|
16
|
+
|
17
|
+
#app=AndroidMarket.get_top_selling_free_app_in_category('COMMUNICATION',100,'pt')
|
18
|
+
|
19
|
+
#app.to_s
|
20
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: android_market_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "H\xC3\xA9lder Vasconcelos"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: hpricot
|
@@ -44,7 +44,7 @@ files:
|
|
44
44
|
- .gitignore
|
45
45
|
- COPYING
|
46
46
|
- Gemfile
|
47
|
-
- README
|
47
|
+
- README.md
|
48
48
|
- Rakefile
|
49
49
|
- android_market_api.gemspec
|
50
50
|
- lib/android_market_api.rb
|
data/README
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
<h2>Android Market Library for parsing Android Market.</h2>
|
2
|
-
|
3
|
-
This is a unoficial API Managed by Bearstouch Software
|
4
|
-
|
5
|
-
This project is under development.
|
6
|
-
|
7
|
-
Fell free to clone it and submit your changes to us.
|
8
|
-
|
9
|
-
Soon it will be available on Rubygem Website
|
10
|
-
|