goodreads-books 0.1.2 → 0.1.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/goodreads_books/cli.rb +1 -1
- data/lib/goodreads_books/scraper.rb +3 -6
- data/lib/goodreads_books/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 582ea3ec63e81d29dfa97f139961d1260e9cc5da205084925c0b6bbc31b3675b
|
4
|
+
data.tar.gz: 3e99a6197c0964bdc28c7d568807142214f6c1a21f7e81740056aff9b2313374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d92e2c594272e9a7ba13478d54db8ca61dd814460a82dc35e1d2dd7950556cae947f1413e78240fb15aec9e947d760b2c2b6892955c0257924a9426ffb0a2c3f
|
7
|
+
data.tar.gz: 60858dec0f6e2baa92bc93a2af0e188d52e42f74d4ef8c98d6154ec3424f07d7071880f43dbf15b5cccfb185415a2611b64d519b0990bc13bee309f23ae755a2
|
data/lib/goodreads_books/cli.rb
CHANGED
@@ -21,7 +21,7 @@ class GoodreadsBooks::CLI
|
|
21
21
|
@awards_year = awards_year
|
22
22
|
puts "Loading The Winners of #{awards_year} Goodreads Choice Awards Books..."
|
23
23
|
if GoodreadsBooks::Book.find_all_by_year(awards_year).empty?
|
24
|
-
|
24
|
+
GoodreadsBooks::Scraper.scrape_books(awards_year)
|
25
25
|
end
|
26
26
|
end #-- load_choice_awards_books --
|
27
27
|
|
@@ -15,9 +15,8 @@ class GoodreadsBooks::Scraper
|
|
15
15
|
main_url = "#{BASE_URL}#{PAGE_URL}/best-books-#{awards_year}"
|
16
16
|
doc = Nokogiri::HTML(open(main_url))
|
17
17
|
|
18
|
-
# Category winners page: iterate through the best book of each category
|
19
|
-
|
20
|
-
doc.css(".category.clearFix").each do |category|
|
18
|
+
# Category winners page: iterate through the best book of each category and collect the book information
|
19
|
+
doc.css(".category.clearFix").collect do |category|
|
21
20
|
category_name = category.css("h4").text
|
22
21
|
category_url = category.css("a").attr("href").text
|
23
22
|
category_title = category.css("img").attr("alt").text
|
@@ -30,10 +29,8 @@ class GoodreadsBooks::Scraper
|
|
30
29
|
:category_url => "#{BASE_URL}#{category_url}"
|
31
30
|
}
|
32
31
|
|
33
|
-
|
32
|
+
GoodreadsBooks::Book.new_from_web_page(book_details)
|
34
33
|
end
|
35
|
-
|
36
|
-
books
|
37
34
|
end #-- self.scrape_books --
|
38
35
|
|
39
36
|
def self.scrape_book_details(book)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goodreads-books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ni Chia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,8 +94,8 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: Goodreads CLI gem is a command line application that lists the
|
98
|
-
Goodreads Choice Awards
|
97
|
+
description: Goodreads CLI gem is a command line application that lists the best books
|
98
|
+
of Goodreads Choice Awards.
|
99
99
|
email:
|
100
100
|
- nichia@gmail.com
|
101
101
|
executables:
|