hotel_price 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/lib/hotel_price/jalan/jalan_api.rb +28 -0
- data/lib/hotel_price/rakuten/rakuten_scraper.rb +19 -0
- data/lib/hotel_price/version.rb +1 -1
- 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: a15be651d24b2be15d291114fa91cc82d1ef8a1cf140c9564ca466173b22fe58
|
4
|
+
data.tar.gz: af0612a4bbd76192a0134d6f270a81826b10200c6fe4a018e4a83f99485c1a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cb17881077dcb30af86c4ee9c1fa4fa6bdd771a6f793e704220b6ff71906eb214b370b20504f7295e027f93e37e3f04649435ac7725398c09290ca7c3fff2a2
|
7
|
+
data.tar.gz: 20c350c2803d53101489e5cdd89fc99da33ff8097f900aeb11ac661acb89fb9d731bc1d6b826d7b182ad7d086be2ee03f94fe376c888939d45073287aef9b857
|
data/.rubocop.yml
CHANGED
@@ -7,5 +7,33 @@ module HotelPrice::Jalan
|
|
7
7
|
def test
|
8
8
|
@api_key
|
9
9
|
end
|
10
|
+
|
11
|
+
def get_price
|
12
|
+
if @doc.css("NumberOfResults").text == "0"
|
13
|
+
{
|
14
|
+
date: DateTime.now.strftime("%Y-%m-%d"),
|
15
|
+
branch_id: @user_info[:branch_id],
|
16
|
+
stay_date: @user_info[:checkindate],
|
17
|
+
adult_num: @user_info[:adult_num],
|
18
|
+
jalan_hotel_id: @user_info[:jalan_hotel_id],
|
19
|
+
plan_num: 0,
|
20
|
+
min_price: 0
|
21
|
+
}
|
22
|
+
else
|
23
|
+
{
|
24
|
+
date: DateTime.now.strftime("%Y-%m-%d"),
|
25
|
+
branch_id: @user_info[:branch_id],
|
26
|
+
channel: "jalan",
|
27
|
+
stay_date: @user_info[:checkindate],
|
28
|
+
adult_num: @user_info[:adult_num],
|
29
|
+
jalan_hotel_id: @user_info[:jalan_hotel_id],
|
30
|
+
hotel_name: @doc.css("Plan").css("Hotel HotelName").text,
|
31
|
+
room_name: @doc.css("Plan").css("RoomName").text,
|
32
|
+
plan_name: @doc.css("Plan").css("PlanName").text,
|
33
|
+
plan_num: @doc.css("NumberOfResults").text,
|
34
|
+
min_price: @doc.css("Plan").css("Stay Rate").text
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
10
38
|
end
|
11
39
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HotelPrice::Rakuten
|
2
|
+
class RakutenScraper
|
3
|
+
def self.review rakuten_hotel_id
|
4
|
+
driver = self.get_selenium_driver
|
5
|
+
driver.get("https://travel.rakuten.co.jp/HOTEL/#{rakuten_hotel_id.to_s}/review.html")
|
6
|
+
sleep 2
|
7
|
+
comment_area = driver.find_elements(:class_name, "commentBox")
|
8
|
+
data = comment_area.map do |f|
|
9
|
+
{
|
10
|
+
date: f.find_element(class_name: "time").text,
|
11
|
+
rakuten_hotel_id: rakuten_hotel_id,
|
12
|
+
comment: f.find_element(class_name: "commentSentence").text
|
13
|
+
}
|
14
|
+
end
|
15
|
+
driver.quit
|
16
|
+
data
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/hotel_price/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotel_price
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fumitake Kawasaki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/hotel_price/rakuten.rb
|
95
95
|
- lib/hotel_price/rakuten/rakuten_api.rb
|
96
96
|
- lib/hotel_price/rakuten/rakuten_console.rb
|
97
|
+
- lib/hotel_price/rakuten/rakuten_scraper.rb
|
97
98
|
- lib/hotel_price/version.rb
|
98
99
|
homepage: https://github.com/el-fudo/hotel_price
|
99
100
|
licenses:
|