hotel_price 0.1.9 → 0.2.0
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/exe/rakuten_travel_review +1 -1
- data/lib/hotel_price.rb +1 -0
- data/lib/hotel_price/version.rb +1 -1
- data/lib/rakuten_travel_review.rb +14 -6
- 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: 46062e452bbaf140402021de2e18bbfab7d75f263817d1e9e390fe1a75992c22
|
4
|
+
data.tar.gz: b3b82149d0d899bc52146174be0ab0b63e13b89338d8fb95ab6476d2bd9e2310
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96187515114012df0d4c0c5430d4db0a72816cf017cb4dda5a076b3b2e70b1a190bc73549e4950bbfd6d21a32c775a51fe221c08479f25c6cd395c5d17c6e377
|
7
|
+
data.tar.gz: '09da4b388b9d72406510b14986dcc8c0c13ae0f768f665494f20307939f6777243086c6c1aea35d3ff0d9e3b94c7a2462e3e346695167ccd469425bcc1e1dc53'
|
data/Gemfile.lock
CHANGED
data/exe/rakuten_travel_review
CHANGED
data/lib/hotel_price.rb
CHANGED
@@ -15,6 +15,7 @@ module HotelPrice
|
|
15
15
|
comment_area = driver.find_elements(:class_name, "commentReputationBoth")
|
16
16
|
data = comment_area.map do |f|
|
17
17
|
{
|
18
|
+
status: "success",
|
18
19
|
date: f.find_element(class_name: "time").text,
|
19
20
|
rakuten_hotel_id: 7770,
|
20
21
|
comment: f.find_element(class_name: "commentSentence").text
|
data/lib/hotel_price/version.rb
CHANGED
@@ -3,17 +3,25 @@ require "selenium-webdriver"
|
|
3
3
|
|
4
4
|
module RakutenTravelReview
|
5
5
|
class Error < StandardError; end
|
6
|
-
def self.rakuten_travel
|
6
|
+
def self.rakuten_travel rakuten_hotel_id
|
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
9
|
options = Selenium::WebDriver::Firefox::Options.new
|
10
10
|
options.add_argument("-headless")
|
11
|
-
driver = Selenium::WebDriver.for :firefox
|
12
|
-
|
13
|
-
driver.get
|
11
|
+
driver = Selenium::WebDriver.for :firefox#, options: options
|
12
|
+
rakuten_travel_hotel_id = rakuten_hotel_id.to_s
|
13
|
+
driver.get("https://travel.rakuten.co.jp/HOTEL/#{rakuten_travel_hotel_id.to_s}/review.html")
|
14
14
|
sleep 2
|
15
|
-
|
15
|
+
comment_area = driver.find_elements(:class_name, "commentBox")
|
16
|
+
data = comment_area.map do |f|
|
17
|
+
{
|
18
|
+
status: "success",
|
19
|
+
date: f.find_element(class_name: "time").text,
|
20
|
+
rakuten_hotel_id: rakuten_hotel_id,
|
21
|
+
comment: f.find_element(class_name: "commentSentence").text
|
22
|
+
}
|
23
|
+
end
|
16
24
|
driver.quit
|
17
|
-
|
25
|
+
data
|
18
26
|
end
|
19
27
|
end
|