Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

apartments.js 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. officeHours: $('.daysHoursContainer').map(function () {
  25. return {
  26. days: $(this).find('.days').text(),
  27. hours: $(this).find('.hours').text(),
  28. };
  29. }).get()
  30. },
  31. // features: $('#uniqueFeatures .uniqueAmenity').map(function () {
  32. // return $(this).find('span').text();
  33. // }).get(),
  34. features: $('.amenitiesSection .amenityCard').map(function () {
  35. return $(this).find('.amenityLabel').text();
  36. }).get(),
  37. prices: $('[data-tab-content-id=all]>.pricingGridItem').add('[data-tab-content-id=all]>.jsAvailableModels').map(function () {
  38. return {
  39. name: $(this).find('.modelName').text(),
  40. available: $(this).hasClass('pricingGridItem'),
  41. rent: $(this).find('.rentLabel').text(),
  42. details: {
  43. rooms: $(this).find('.detailsTextWrapper>span:nth-child(1)').text(),
  44. baths: $(this).find('.detailsTextWrapper>span:nth-child(2)').text(),
  45. area: $(this).find('.detailsTextWrapper>span:nth-child(3)').html(),
  46. available: $(this).find('.availabilityInfo').html(),
  47. },
  48. url: $(this).find('.floorPlanButtonImage').attr('data-background-image'),
  49. plan: $(this).find('.allAmenities>li').map(function () {
  50. return {
  51. title: $(this).find('.topAmenity').html(),
  52. amenities: $(this).find('.amenity').map(function () {
  53. return $(this).text();
  54. }).get(),
  55. };
  56. }).get(),
  57. };
  58. }).get()
  59. };
  60. var data = JSON.parse(JSON.stringify(result)
  61. .split(' ').join('')
  62. .split(' ').join('')
  63. .split(' ').join('')
  64. .split(' ').join('')
  65. .split('\\n').join(''));
  66. return data;
  67. }