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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee443a8f6802b7cbe1a7267ab58303f8010a83114c100ac6efa249549d3ad724
4
- data.tar.gz: e55241d3dc41e439cc842663b30e5b03d301f8f7114329bcab66454d5ed3b8f8
3
+ metadata.gz: ccf2c2095b72362bb01d973139994f4a2a9c96e3dc1a3164e1bd843dc8753c0c
4
+ data.tar.gz: 4ccc1a23f643290d57831dc7495082cbda321ef7548d2d1ab63017ea9800a783
5
5
  SHA512:
6
- metadata.gz: b1ad7509a90d6fe09bd49f34e10742f76d3f5c5d2d01912a073e65a5613100b9281e90aee8cceb0130879630f931f3885fcedbcf51f463654eb39e424fff49d0
7
- data.tar.gz: 9097e660d2832bac31eb8fb302f6af8f434ec5f5e3a8d026693d2baa91871ea097aa5c0caafc6e05d5ccde66d118b50ecddacf7d7473b2e40086f7d2f8a4099c
6
+ metadata.gz: 85d6608654d2e5dd970db77579b3e1408b9bbf27e93accaaff87f9aff77d5844c7bced63f8a66ef2f097dd846d39a9373c64c359de2ce6673965c4d085960530
7
+ data.tar.gz: 12120c23fb30599318e54e5f652850c70bb9dfa36ca4b8136bb53e53ff0c285889a45e9e0b4d31dfe7a7960b632c141cfe50eeab614bb3a26f9a4cfd9f31eb9e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hotel_price (0.1.7)
4
+ hotel_price (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- `hotel_price`
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/[USERNAME]/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
+ 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
- driver = Selenium::WebDriver.for :firefox
10
- driver.get('https://travel.rakuten.co.jp/')
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
- title = driver.find_element(:tag_name, "p").text
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
- title
24
+ data
15
25
  end
16
26
  end
@@ -1,3 +1,3 @@
1
1
  module HotelPrice
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -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
- driver = Selenium::WebDriver.for :firefox
10
- driver.get('https://travel.rakuten.co.jp/')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotel_price
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - el-fudo