Parcourir la source

Merge branch 'newChanges' into master

master
Nikola Ignjatovic il y a 4 ans
Parent
révision
252072fd59
3 fichiers modifiés avec 59 ajouts et 19 suppressions
  1. 15
    11
      apartments.js
  2. 34
    0
      condos.js
  3. 10
    8
      houses.js

+ 15
- 11
apartments.js Voir le fichier

var request = require('request').defaults({ encoding: null }); var request = require('request').defaults({ encoding: null });
module.exports.apartment = function($) { 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(), name: $('#propertyName').text(),
description: $('#descriptionSection>p').html(), description: $('#descriptionSection>p').html(),
rentInfo : $('#priceBedBathAreaInfoWrapper .rentInfoDetail').html(),
review: $('.propertyReviewContainer .reviewRating').html(),
lastUpdate : $('.freshnessUserActionsContainer .lastUpdated>span').text(),
address: { address: {
street: $('.propertyAddressContainer h2>span:nth-child(1)').text(), street: $('.propertyAddressContainer h2>span:nth-child(1)').text(),
city: $('.propertyAddressContainer h2>span:nth-child(2)').text(), city: $('.propertyAddressContainer h2>span:nth-child(2)').text(),
}; };
}).get() }).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 () { prices: $('[data-tab-content-id=all]>.pricingGridItem').add('[data-tab-content-id=all]>.jsAvailableModels').map(function () {
return { return {
name: $(this).find('.modelName').text(), name: $(this).find('.modelName').text(),
area: $(this).find('.detailsTextWrapper>span:nth-child(3)').html(), area: $(this).find('.detailsTextWrapper>span:nth-child(3)').html(),
available: $(this).find('.availabilityInfo').html(), available: $(this).find('.availabilityInfo').html(),
}, },
url: $(this).find('.floorPlanButtonImage').attr('data-background-image'),
plan: $(this).find('.allAmenities>li').map(function () { plan: $(this).find('.allAmenities>li').map(function () {
return {
return {
title: $(this).find('.topAmenity').html(), title: $(this).find('.topAmenity').html(),
amenities: $(this).find('.amenity').map(function () { amenities: $(this).find('.amenity').map(function () {
return $(this).text(); return $(this).text();

+ 34
- 0
condos.js Voir le fichier

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 Voir le fichier

module.exports.house = function($) { module.exports.house = function($) {
var result = { var result = {
images: $('.aspectRatioImage').map(function(){
return { src : $(this).find('img').attr("src") };
}).get(),
name: $('#propertyName').text(), name: $('#propertyName').text(),
description: $('#descriptionSection>p').html(), description: $('#descriptionSection>p').html(),
lastUpdate : $('.freshnessUserActionsContainer .lastUpdated>span').text(),
address: { address: {
street: $('.propertyAddressContainer h2>span:nth-child(1)').text(), street: $('.propertyAddressContainer h2>span:nth-child(1)').text(),
city: $('.propertyAddressContainer h2>span:nth-child(2)').text(), city: $('.propertyAddressContainer h2>span:nth-child(2)').text(),
code: $('.propertyAddressContainer .stateZipContainer>span:nth-child(2)').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: { contact: {
phone: $('.contactInfo .phoneNumber span').html(), 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) var data = JSON.parse(JSON.stringify(result)

Chargement…
Annuler
Enregistrer