Browse Source

Merge branch 'newChanges' into master

master
Nikola Ignjatovic 4 years ago
parent
commit
252072fd59
3 changed files with 59 additions and 19 deletions
  1. 15
    11
      apartments.js
  2. 34
    0
      condos.js
  3. 10
    8
      houses.js

+ 15
- 11
apartments.js View File

@@ -1,14 +1,14 @@
var request = require('request').defaults({ encoding: null });
module.exports.apartment = function($) {
var result = {
// images: request.get($('.aspectRatioImage').find('img')[0].attribs.src, function (error, response, body) {
// if (!error && response.statusCode == 200) {
// data = "data:" + response.headers["content-type"] + ";base64," + Buffer.from(body).toString('base64');
// return data;
// }
// }),
var result = {
images: $('.aspectRatioImage').map(function(){
return { src : $(this).find('img').attr("src") };
}).get(),
name: $('#propertyName').text(),
description: $('#descriptionSection>p').html(),
rentInfo : $('#priceBedBathAreaInfoWrapper .rentInfoDetail').html(),
review: $('.propertyReviewContainer .reviewRating').html(),
lastUpdate : $('.freshnessUserActionsContainer .lastUpdated>span').text(),
address: {
street: $('.propertyAddressContainer h2>span:nth-child(1)').text(),
city: $('.propertyAddressContainer h2>span:nth-child(2)').text(),
@@ -28,9 +28,12 @@ module.exports.apartment = function($) {
};
}).get()
},
features: $('#uniqueFeatures .uniqueAmenity').map(function () {
return $(this).find('span').text();
}).get(),
// features: $('#uniqueFeatures .uniqueAmenity').map(function () {
// return $(this).find('span').text();
// }).get(),
features: $('.amenitiesSection .amenityCard').map(function () {
return $(this).find('.amenityLabel').text();
}).get(),
prices: $('[data-tab-content-id=all]>.pricingGridItem').add('[data-tab-content-id=all]>.jsAvailableModels').map(function () {
return {
name: $(this).find('.modelName').text(),
@@ -42,8 +45,9 @@ module.exports.apartment = function($) {
area: $(this).find('.detailsTextWrapper>span:nth-child(3)').html(),
available: $(this).find('.availabilityInfo').html(),
},
url: $(this).find('.floorPlanButtonImage').attr('data-background-image'),
plan: $(this).find('.allAmenities>li').map(function () {
return {
return {
title: $(this).find('.topAmenity').html(),
amenities: $(this).find('.amenity').map(function () {
return $(this).text();

+ 34
- 0
condos.js View File

@@ -0,0 +1,34 @@
module.exports.condo = function($) {
var result = {
images: $('.aspectRatioImage').map(function(){
return { src : $(this).find('img').attr("src") };
}).get(),
name: $('#propertyName').text(),
description: $('#descriptionSection>p').html(),
lastUpdate : $('.freshnessUserActionsContainer .lastUpdated>span').text(),
address: {
street: $('.propertyAddressContainer h2>span:nth-child(1)').text(),
city: $('.propertyAddressContainer h2>span:nth-child(2)').text(),
zip: {
state: $('.propertyAddressContainer .stateZipContainer>span:nth-child(1)').text(),
code: $('.propertyAddressContainer .stateZipContainer>span:nth-child(2)').text(),
}
},
rentInfo : $('#priceBedBathAreaInfoWrapper .column:eq(0)').find(".rentInfoDetail").html(),
features: $('#priceBedBathAreaInfoWrapper .column:not(:first)').map(function () {
return $(this).find('.rentInfoDetail').text();
}).get(),
contact: {
phone: $('.contactInfo .phoneNumber span').html(),
agentFullName: $('.agentFullName').text(),
},
};
var data = JSON.parse(JSON.stringify(result)
.split(' ').join('')
.split(' ').join('')
.split(' ').join('')
.split(' ').join('')
.split('\\n').join(''));
return data;
}

+ 10
- 8
houses.js View File

@@ -1,7 +1,11 @@
module.exports.house = function($) {
var result = {
images: $('.aspectRatioImage').map(function(){
return { src : $(this).find('img').attr("src") };
}).get(),
name: $('#propertyName').text(),
description: $('#descriptionSection>p').html(),
lastUpdate : $('.freshnessUserActionsContainer .lastUpdated>span').text(),
address: {
street: $('.propertyAddressContainer h2>span:nth-child(1)').text(),
city: $('.propertyAddressContainer h2>span:nth-child(2)').text(),
@@ -10,16 +14,14 @@ module.exports.house = function($) {
code: $('.propertyAddressContainer .stateZipContainer>span:nth-child(2)').text(),
}
},
rentInfo : $('#priceBedBathAreaInfoWrapper .column:eq(0)').find(".rentInfoDetail").html(),
features: $('#priceBedBathAreaInfoWrapper .column:not(:first)').map(function () {
return $(this).find('.rentInfoDetail').text();
}).get(),
contact: {
phone: $('.contactInfo .phoneNumber span').html(),
//language: $('.contactInfo .languages span').html(),
url: $('.contactInfo .mortar-wrapper a').attr('href'),
// officeHours: $('.daysHoursContainer').map(function () {
// return {
// days: $(this).find('.days').text(),
// hours: $(this).find('.hours').text(),
// };
// }).get()
agentFullName: $('.agentFullName').text(),
},
};
var data = JSON.parse(JSON.stringify(result)

Loading…
Cancel
Save