daily-trending-apps 0.1.5 → 0.1.6
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/daily_trending.rb +1 -0
- data/lib/daily_trending/app.rb +14 -18
- data/lib/daily_trending/cli.rb +23 -10
- data/lib/daily_trending/scraper.rb +19 -0
- data/lib/daily_trending/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43666444a76e12573ff04637bb7d44ac498cc9288484fcdb00d7c2ba720c39ef
|
4
|
+
data.tar.gz: 2ce4844870661be6552f0ebebbb7af8a77e4925c13aa3fdd8711abf40e07bd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba681278291f9d13518f3e440c10282e1bfce6a7f9df087788490c6eda9e31ed9da423360a0dec8ce74cd34d355d2eacd14f4030a39b0b5694213490eb03e72b
|
7
|
+
data.tar.gz: cd7aa30077816f56c35a7f72e95792ae38d19671938f06416abca7b72421561825a600a1c8b3d79399f32612b9d031432c1fdd39b82a662348bbd4ceb1d81e70
|
data/lib/daily_trending.rb
CHANGED
data/lib/daily_trending/app.rb
CHANGED
@@ -3,17 +3,14 @@ class DailyTrending::App
|
|
3
3
|
@@all = []
|
4
4
|
|
5
5
|
|
6
|
-
def self.scrape_play_store
|
7
|
-
doc = Nokogiri::HTML(open("https://play.google.com/store/apps/collection/promotion_3000792_new_releases_apps?clp=SpEBCikKI3Byb21vdGlvbl8zMDAwNzkyX25ld19yZWxlYXNlc19hcHBzEAcYAxpkCl5uZXdfaG9tZV9kZXZpY2VfZmVhdHVyZWRfcmVjczJfdG9waWNfdjFfbGF1bmNoX2FwcHNfVVNfXzE1MTQ0NDgwMDAwMDBfNl9wcm9tb18xNTE0NDkxNzcwMTgwMDAwEAwYAw%3D%3D%3AS%3AANO1ljLrBj0&hl=en"))
|
8
|
-
doc.css('div.card-content.id-track-click.id-track-impression')
|
9
|
-
end
|
10
|
-
|
11
6
|
|
12
7
|
# Iterates #scrape_play_store method to # Makes the apps and assigns
|
13
8
|
# the attributes available on Google play store
|
14
9
|
|
15
|
-
|
16
|
-
|
10
|
+
|
11
|
+
|
12
|
+
# def self.make_apps
|
13
|
+
def self.new_from_index(a)
|
17
14
|
app = self.new
|
18
15
|
app.title = a.css('a.title').attribute('title').value
|
19
16
|
app.dev = a.css('a.subtitle').attribute('title').value
|
@@ -21,11 +18,15 @@ class DailyTrending::App
|
|
21
18
|
app.app_url = ("https://play.google.com" + a.css('a.title').attribute('href').value)
|
22
19
|
app.rating = a.css('div.tiny-star').attribute('aria-label').value.strip.slice(/\d.\S/)<<"/5 Stars"
|
23
20
|
app.price = a.at_css('span.display-price').text
|
24
|
-
app.save
|
25
|
-
|
26
|
-
|
21
|
+
app.exist? ? all.freeze : app.save
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def exist?
|
26
|
+
self.class.all.any?{|ap| ap.title == self.title}
|
27
27
|
end
|
28
28
|
|
29
|
+
|
29
30
|
def save
|
30
31
|
@@all << self
|
31
32
|
end
|
@@ -35,16 +36,11 @@ class DailyTrending::App
|
|
35
36
|
end
|
36
37
|
|
37
38
|
|
38
|
-
def
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
def make_app(url)
|
44
|
-
page = scrape_app(url)
|
39
|
+
def make_app(xml_info)
|
40
|
+
page = xml_info
|
45
41
|
self.genre = page.css('a.document-subtitle.category').text
|
42
|
+
self.description = page.css('div.show-more-content.text-body').text
|
46
43
|
self.con_rating = page.css('span.document-subtitle.content-rating-title').text
|
47
44
|
self.rate_cnt = page.css('span.rating-count').text
|
48
|
-
self.description = page.css('div.show-more-content.text-body').text
|
49
45
|
end
|
50
46
|
end
|
data/lib/daily_trending/cli.rb
CHANGED
@@ -7,15 +7,15 @@ class DailyTrending::Cli
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def list_apps
|
10
|
-
s = "******".colorize(:
|
10
|
+
s = "******".colorize(:red)
|
11
11
|
puts ""
|
12
12
|
puts " #{s}"+"New And Updated Apps!"+s
|
13
13
|
puts ""
|
14
14
|
|
15
|
-
@apps = DailyTrending::
|
15
|
+
@apps = DailyTrending::Scraper.make_apps unless @apps != nil
|
16
16
|
@apps.each.with_index(1) do |app, i|
|
17
17
|
puts <<-DOC
|
18
|
-
#{i} #{app.title.colorize(:blue)}
|
18
|
+
#{i}. #{app.title.colorize(:blue)}
|
19
19
|
#{app.rating} Cost: #{app.price}
|
20
20
|
|
21
21
|
DOC
|
@@ -26,7 +26,7 @@ class DailyTrending::Cli
|
|
26
26
|
def menu
|
27
27
|
input = nil
|
28
28
|
until input == 'exit'
|
29
|
-
puts "Enter the number of the app
|
29
|
+
puts "Enter the number of the app you'd like more info on, or type exit"
|
30
30
|
input = gets.strip.downcase
|
31
31
|
|
32
32
|
if input.to_i > 0
|
@@ -40,10 +40,11 @@ class DailyTrending::Cli
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def app_info(app)
|
43
|
-
|
43
|
+
xml_info = DailyTrending::Scraper.scrape_app(app.app_url)
|
44
|
+
app.make_app(xml_info)
|
44
45
|
puts <<-DOC
|
45
46
|
#{app.title.upcase.colorize(:blue)}
|
46
|
-
|
47
|
+
Developers: #{app.dev}
|
47
48
|
Content For: #{app.con_rating}
|
48
49
|
Rated By: #{app.rate_cnt}
|
49
50
|
|
@@ -57,11 +58,23 @@ class DailyTrending::Cli
|
|
57
58
|
More Apps By #{app.dev}: #{app.dev_url.colorize(:red)}
|
58
59
|
|
59
60
|
DOC
|
61
|
+
input = nil
|
62
|
+
puts " Type 'list' to see apps again or 'exit' to leave"
|
63
|
+
until input == 'list'|| input == 'exit'
|
64
|
+
input = gets.strip.downcase
|
65
|
+
if input == 'list'
|
66
|
+
list_apps
|
67
|
+
elsif input == 'exit'
|
68
|
+
goodbye
|
69
|
+
exit
|
70
|
+
else
|
71
|
+
puts " #{input} not an option, type list or exit" unless input == 'exit'
|
72
|
+
end
|
60
73
|
end
|
74
|
+
end
|
61
75
|
|
62
76
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
77
|
+
def goodbye
|
78
|
+
puts "See you next time!!"
|
79
|
+
end
|
67
80
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class DailyTrending::Scraper
|
2
|
+
|
3
|
+
def self.scrape_play_store
|
4
|
+
doc = Nokogiri::HTML(open("https://play.google.com/store/apps/collection/promotion_3000792_new_releases_apps?clp=SpEBCikKI3Byb21vdGlvbl8zMDAwNzkyX25ld19yZWxlYXNlc19hcHBzEAcYAxpkCl5uZXdfaG9tZV9kZXZpY2VfZmVhdHVyZWRfcmVjczJfdG9waWNfdjFfbGF1bmNoX2FwcHNfVVNfXzE1MTQ0NDgwMDAwMDBfNl9wcm9tb18xNTE0NDkxNzcwMTgwMDAwEAwYAw%3D%3D%3AS%3AANO1ljLrBj0&hl=en"))
|
5
|
+
doc.css('div.card-content.id-track-click.id-track-impression')
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.make_apps
|
9
|
+
scrape_play_store.each do |a|
|
10
|
+
DailyTrending::App.new_from_index(a)
|
11
|
+
end
|
12
|
+
DailyTrending::App.all
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.scrape_app(app_url)
|
16
|
+
Nokogiri::HTML(open(app_url))
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daily-trending-apps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "'Chad Montoya'"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/daily_trending.rb
|
93
93
|
- lib/daily_trending/app.rb
|
94
94
|
- lib/daily_trending/cli.rb
|
95
|
+
- lib/daily_trending/scraper.rb
|
95
96
|
- lib/daily_trending/version.rb
|
96
97
|
homepage: https://github.com/badlychadly/daily-trending-apps-cli-gem
|
97
98
|
licenses:
|