-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
69 lines (63 loc) · 2.15 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
"use strict";
const fs = require("fs");
fs.readFile("./src/hotels.json", (err, data) => {
if (err) throw err;
let hotels = JSON.parse(data);
let sections = hotels.data.AppPresentation_queryAppListV2[0].sections;
//for attaining the name of the hotel from the hotels api request
// sections.map((section) => {
// if (section.singleCardContent) {
// console.log(section.singleCardContent.cardTitle.string);
// }
// });
//for attaining the images of the hotels
sections.map((section) => {
if (section.singleCardContent) {
console.log(
section.singleCardContent.cardPhotos.map((photo, i) => {
// console.log(photo.sizes.urlTemplate);
// console.log("\n");
if (photo) {
console.log(i, photo.sizes.urlTemplate);
console.log("\n");
}
})
);
// console.log(sections.singleCardContent.cardPhotos[0].sizes.urlTemplate);
}
});
//number of stars review of the hotel
// sections.map((section) => {
// if (section.singleCardContent) {
// if (section.singleCardContent.bubbleRating) {
// // how many stars
// //int
// console.log(section.singleCardContent.bubbleRating.rating);
// //how many people reviewed the place
// //string
// console.log(
// section.singleCardContent.bubbleRating.numberReviews.string
// );
// }
// }
// });
});
// fs.readFile("./src/locations.json", (err, data) => {
// if (err) throw err;
// let locations = JSON.parse(data);
// //probably for the map, we will choose just the first location
// //then send the longitude and latitude componenet to the google maps component
// let places = locations.data.Typeahead_autocomplete.results;
// places.map((place) => {
// if (place.detailsV2) {
// if (place.detailsV2.geocode) {
// //place name
// console.log(place.detailsV2.names.name);
// //latitude
// console.log(place.detailsV2.geocode.latitude);
// //longitude
// console.log(place.detailsV2.geocode.longitude);
// }
// }
// });
// });