You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apartments.js 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. var request = require('request').defaults({ encoding: null });
  2. module.exports.apartment = function($) {
  3. var result = {
  4. images: $('.aspectRatioImage').map(function(){
  5. return { src : $(this).find('img').attr("src") };
  6. }).get(),
  7. name: $('#propertyName').text(),
  8. description: $('#descriptionSection>p').html(),
  9. rentInfo : $('#priceBedBathAreaInfoWrapper .rentInfoDetail').html(),
  10. review: $('.propertyReviewContainer .reviewRating').html(),
  11. lastUpdate : $('.freshnessUserActionsContainer .lastUpdated>span').text(),
  12. address: {
  13. street: $('.propertyAddressContainer h2>span:nth-child(1)').text(),
  14. city: $('.propertyAddressContainer h2>span:nth-child(2)').text(),
  15. zip: {
  16. state: $('.propertyAddressContainer .stateZipContainer>span:nth-child(1)').text(),
  17. code: $('.propertyAddressContainer .stateZipContainer>span:nth-child(2)').text(),
  18. }
  19. },
  20. contact: {
  21. phone: $('.contactInfo .phoneNumber span').html(),
  22. language: $('.contactInfo .languages span').html(),
  23. url: $('.contactInfo .mortar-wrapper a').attr('href'),
  24. todayHours: $('.todaysHoursContactContainer .todaysHours>span').text(),
  25. officeHours: $('.daysHoursContainer').map(function () {
  26. return {
  27. days: $(this).find('.days').text(),
  28. hours: $(this).find('.hours').text(),
  29. };
  30. }).get()
  31. },
  32. // features: $('#uniqueFeatures .uniqueAmenity').map(function () {
  33. // return $(this).find('span').text();
  34. // }).get(),
  35. features: $('.amenitiesSection .amenityCard').map(function () {
  36. return $(this).find('.amenityLabel').text();
  37. }).get(),
  38. prices: $('[data-tab-content-id=all]>.pricingGridItem').add('[data-tab-content-id=all]>.jsAvailableModels').map(function () {
  39. return {
  40. name: $(this).find('.modelName').text(),
  41. available: $(this).hasClass('pricingGridItem'),
  42. rent: $(this).find('.rentLabel').text(),
  43. details: {
  44. rooms: $(this).find('.detailsTextWrapper>span:nth-child(1)').text(),
  45. baths: $(this).find('.detailsTextWrapper>span:nth-child(2)').text(),
  46. area: $(this).find('.detailsTextWrapper>span:nth-child(3)').html(),
  47. available: $(this).find('.availabilityInfo').html(),
  48. },
  49. url: $(this).find('.floorPlanButtonImage').attr('data-background-image'),
  50. plan: $(this).find('.allAmenities>li').map(function () {
  51. return {
  52. title: $(this).find('.topAmenity').html(),
  53. amenities: $(this).find('.amenity').map(function () {
  54. return $(this).text();
  55. }).get(),
  56. };
  57. }).get(),
  58. };
  59. }).get()
  60. };
  61. var data = JSON.parse(JSON.stringify(result)
  62. .split(' ').join('')
  63. .split(' ').join('')
  64. .split(' ').join('')
  65. .split(' ').join('')
  66. .split('\\n').join(''));
  67. return data;
  68. }