| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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;
- // }
- // }),
- name: $('#propertyName').text(),
- description: $('#descriptionSection>p').html(),
- 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(),
- }
- },
- 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()
- },
- features: $('#uniqueFeatures .uniqueAmenity').map(function () {
- return $(this).find('span').text();
- }).get(),
- prices: $('[data-tab-content-id=all]>.pricingGridItem').add('[data-tab-content-id=all]>.jsAvailableModels').map(function () {
- return {
- name: $(this).find('.modelName').text(),
- available: $(this).hasClass('pricingGridItem'),
- rent: $(this).find('.rentLabel').text(),
- details: {
- rooms: $(this).find('.detailsTextWrapper>span:nth-child(1)').text(),
- baths: $(this).find('.detailsTextWrapper>span:nth-child(2)').text(),
- area: $(this).find('.detailsTextWrapper>span:nth-child(3)').html(),
- available: $(this).find('.availabilityInfo').html(),
- },
- plan: $(this).find('.allAmenities>li').map(function () {
- return {
- title: $(this).find('.topAmenity').html(),
- amenities: $(this).find('.amenity').map(function () {
- return $(this).text();
- }).get(),
- };
- }).get(),
- };
- }).get()
- };
- var data = JSON.parse(JSON.stringify(result)
- .split(' ').join('')
- .split(' ').join('')
- .split(' ').join('')
- .split(' ').join('')
- .split('\\n').join(''));
- return data;
- }
|