amazon_wish_miner 0.1.6 → 0.1.7
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/amazon_wish_miner/amazon_wish.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ed9d8ca08ac0e416d9d359e6435e7eb6022edc596b690b6821315ed83be4f6
|
4
|
+
data.tar.gz: f43b53c69d376a8d00c90c16ff21452525149952af44736cd6f519684c3f0b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d72ba09179802b95b11dfc64ccf3ef27e7907a431ddeb7d8a9febd7b845ae0bb53f0a974411815a92f2b234ad882e98d133efd0ea110c17a4352290861983cf
|
7
|
+
data.tar.gz: c5356e89dd5a5af8326c354bf63e7d1d43617c99261e2f685aeaf927b0403fd4fa5ddcaffa9418bc84821f18f0689559a8d8315d1d6a3f7b79bf70c49c8ca9ae
|
@@ -55,7 +55,7 @@ class AmazonWish
|
|
55
55
|
item_url = 'https://www.amazon.com/dp/' + id
|
56
56
|
response = RestClient.get(item_url)
|
57
57
|
page = Nokogiri::HTML(response)
|
58
|
-
title = page
|
58
|
+
title = get_title_from_page(page)
|
59
59
|
# not a typo, css selectors are
|
60
60
|
#=> case sensetive, and we need to capture e.g. both "productTitle" and "ebookProductTitle"
|
61
61
|
# price = page.css('priceblock_ourprice')
|
@@ -69,6 +69,12 @@ class AmazonWish
|
|
69
69
|
bullets = feature_bullets_div.css('ul li')
|
70
70
|
end
|
71
71
|
|
72
|
+
def self.get_title_from_page(page)
|
73
|
+
span_title = page.css('span[id$="roductTitle"]').children.text.strip
|
74
|
+
return span_title unless span_title == ""
|
75
|
+
meta_title = page.css('meta[name="title"]')[0].attribute('content').value
|
76
|
+
end
|
77
|
+
|
72
78
|
def self.trim_title(untrimmed_title)
|
73
79
|
chars = untrimmed_title.chars
|
74
80
|
chars.drop_while(&TITLE_TRIMMER).reverse.drop_while(&TITLE_TRIMMER).reverse.join
|