hotel_price 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -2
- data/lib/hotel_price.rb +14 -4
- data/lib/hotel_price/version.rb +1 -1
- data/lib/rakuten_travel_review.rb +5 -2
- 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: ccf2c2095b72362bb01d973139994f4a2a9c96e3dc1a3164e1bd843dc8753c0c
|
4
|
+
data.tar.gz: 4ccc1a23f643290d57831dc7495082cbda321ef7548d2d1ab63017ea9800a783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85d6608654d2e5dd970db77579b3e1408b9bbf27e93accaaff87f9aff77d5844c7bced63f8a66ef2f097dd846d39a9373c64c359de2ce6673965c4d085960530
|
7
|
+
data.tar.gz: 12120c23fb30599318e54e5f652850c70bb9dfa36ca4b8136bb53e53ff0c285889a45e9e0b4d31dfe7a7960b632c141cfe50eeab614bb3a26f9a4cfd9f31eb9e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,8 @@ Or install it yourself as:
|
|
20
20
|
## Usage
|
21
21
|
|
22
22
|
Get Rakuten Travel Top Page Title
|
23
|
-
|
23
|
+
|
24
|
+
$ hotel_price
|
24
25
|
|
25
26
|
## Development
|
26
27
|
|
@@ -30,7 +31,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
30
31
|
|
31
32
|
## Contributing
|
32
33
|
|
33
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/el-fudo/hotel_price. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
34
35
|
|
35
36
|
## License
|
36
37
|
|
data/lib/hotel_price.rb
CHANGED
@@ -6,11 +6,21 @@ module HotelPrice
|
|
6
6
|
def self.rakuten_travel
|
7
7
|
# firefox_capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
|
8
8
|
# @driver = Selenium::WebDriver.for(:remote, url: "http://hub:4444/wd/hub", desired_capabilities: firefox_capabilities)
|
9
|
-
|
10
|
-
|
9
|
+
options = Selenium::WebDriver::Firefox::Options.new
|
10
|
+
options.add_argument("-headless")
|
11
|
+
driver = Selenium::WebDriver.for :firefox, options: options
|
12
|
+
rakuten_travel_hotel_id = 7770
|
13
|
+
driver.get("https://travel.rakuten.co.jp/HOTEL/#{rakuten_travel_hotel_id.to_s}/review.html")
|
11
14
|
sleep 2
|
12
|
-
|
15
|
+
comment_area = driver.find_elements(:class_name, "commentReputationBoth")
|
16
|
+
data = comment_area.map do |f|
|
17
|
+
{
|
18
|
+
date: f.find_element(class_name: "time").text,
|
19
|
+
rakuten_hotel_id: 7770,
|
20
|
+
comment: f.find_element(class_name: "commentSentence").text
|
21
|
+
}
|
22
|
+
end
|
13
23
|
driver.quit
|
14
|
-
|
24
|
+
data
|
15
25
|
end
|
16
26
|
end
|
data/lib/hotel_price/version.rb
CHANGED
@@ -6,8 +6,11 @@ module RakutenTravelReview
|
|
6
6
|
def self.rakuten_travel
|
7
7
|
# firefox_capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
|
8
8
|
# @driver = Selenium::WebDriver.for(:remote, url: "http://hub:4444/wd/hub", desired_capabilities: firefox_capabilities)
|
9
|
-
|
10
|
-
|
9
|
+
options = Selenium::WebDriver::Firefox::Options.new
|
10
|
+
options.add_argument("-headless")
|
11
|
+
driver = Selenium::WebDriver.for :firefox, options: options
|
12
|
+
base_url = "https://travel.rakuten.co.jp/HOTEL/7770/review.html"
|
13
|
+
driver.get base_url
|
11
14
|
sleep 2
|
12
15
|
title = driver.find_element(:tag_name, "p").text
|
13
16
|
driver.quit
|