libri 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/libri/book.rb +2 -10
- data/lib/libri/cli.rb +1 -1
- data/lib/libri/scraper.rb +4 -6
- data/lib/libri/version.rb +1 -1
- data/libri-0.2.2.gem +0 -0
- 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: c8a17764f20b0acdd8efd6d489ec96761c6a6bf0f8ae5ee8910294d4d2e57b02
|
4
|
+
data.tar.gz: a3781d8417dc86c32664488128bdc22834aa7beaa0312f6c6fd17511cb68ef51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83202af63f6dbe9be508f18ca160535414ba913b7789f1d379626d6346ef49e6346b8f5f3362af9fb05531b9be60d5c977f12a4894a49045ec0a3d7ab4973755
|
7
|
+
data.tar.gz: df40f7a748b0323b842bbb4fb041d33d42961f391620b03f553cd3927626b826066ee0473bac5a7d01704fabfee075d4af4b8de63e04f6ded1953058c8ae3746
|
data/.DS_Store
CHANGED
Binary file
|
data/lib/.DS_Store
CHANGED
Binary file
|
data/lib/libri/book.rb
CHANGED
@@ -15,17 +15,9 @@ class Libri::Book
|
|
15
15
|
self.new(book_info_hash)
|
16
16
|
}
|
17
17
|
end
|
18
|
-
|
19
|
-
def add_book_info(book_info_hash)
|
20
|
-
book_info_hash.each { |key, val|
|
21
|
-
send "#{key}=", val
|
22
|
-
}
|
23
|
-
self
|
24
|
-
end
|
25
18
|
|
26
|
-
|
19
|
+
def self.all
|
27
20
|
@@all
|
28
|
-
|
29
|
-
|
21
|
+
end
|
30
22
|
|
31
23
|
end
|
data/lib/libri/cli.rb
CHANGED
@@ -31,7 +31,7 @@ class Libri::CLI
|
|
31
31
|
def call
|
32
32
|
puts STRING
|
33
33
|
puts SPACE
|
34
|
-
puts "Welcome to Libri,
|
34
|
+
puts "Welcome to Libri. I'm the Raven, your guide in this chamber full of literary wonders.".blue
|
35
35
|
puts "Below are some of the most prized literary awards of our time.".blue
|
36
36
|
puts "Come freely. This will take a few moments..".blue
|
37
37
|
puts LINE
|
data/lib/libri/scraper.rb
CHANGED
@@ -6,9 +6,6 @@ class Scraper
|
|
6
6
|
html = "https://www.barnesandnoble.com/b/books/awards/_/N-29Z8q8Z1d6q"
|
7
7
|
awards_page = Nokogiri::HTML(open(html))
|
8
8
|
|
9
|
-
# awards.name = awards_page.css("ul#sidebar-section-0 li a").text
|
10
|
-
# awards.url = awards_page.css("ul#sidebar-section-0 li a").attribute("href").value
|
11
|
-
|
12
9
|
awards_array = []
|
13
10
|
awards = {}
|
14
11
|
|
@@ -38,7 +35,8 @@ class Scraper
|
|
38
35
|
|
39
36
|
books_array << books
|
40
37
|
}
|
41
|
-
|
38
|
+
|
39
|
+
books_array.uniq
|
42
40
|
end
|
43
41
|
|
44
42
|
def self.scrape_book(book)
|
@@ -52,7 +50,7 @@ class Scraper
|
|
52
50
|
:title_by_author => info_section.css("div#productInfoOverview div.mb-m").text,
|
53
51
|
:blurbs_and_plot => info_section.css("div#productInfoOverview p").map(&:text).join("\n").strip,
|
54
52
|
:about_author => info_section.css("div#MeetTheAuthor div.text--medium").text.strip,
|
55
|
-
:excerpt => info_section.xpath("//div[@class='read-an-excerpt']/p[not(@class) and position()<
|
53
|
+
:excerpt => info_section.xpath("//div[@class='read-an-excerpt']/p[not(@class) and position()<5]").map(&:text).join("\n"),
|
56
54
|
# :related_books => book_page.css("div.product-shelf-info").each { |book|
|
57
55
|
# related_books_hash = {
|
58
56
|
# :title => book.css("div.product-shelf-title").text.strip,
|
@@ -64,7 +62,7 @@ class Scraper
|
|
64
62
|
:url => book[:url]
|
65
63
|
}
|
66
64
|
|
67
|
-
|
65
|
+
book_info_hash.delete_if { |key, val| val.to_s.strip.empty? }
|
68
66
|
|
69
67
|
end
|
70
68
|
|
data/lib/libri/version.rb
CHANGED
data/libri-0.2.2.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jouissances
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/libri/quote.rb
|
128
128
|
- lib/libri/scraper.rb
|
129
129
|
- lib/libri/version.rb
|
130
|
+
- libri-0.2.2.gem
|
130
131
|
- libri.gemspec
|
131
132
|
- spec.md
|
132
133
|
homepage: https://rubygems.org
|