Last active
July 10, 2023 00:02
-
-
Save powerwlsl/27f648fa364b43dfd21176687a63b259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var destinationGoogleSheetURL = 'https://docs.google.com/spreadsheets/d/1Y2-9AhJZY2hgHIdRcxFajOR-KA-0nGzXeQKJMkXTfEk/edit#gid=0'; | |
var pageLimit = document.querySelector('#m_lblPagingSummary > b:nth-child(3)').innerText; | |
pageLimit = parseInt(pageLimit); | |
for(var i = 1; i <= pageLimit; i++) { | |
setTimeout(function() { | |
var listingAddress = document.querySelector(".d-mega.d-fontSize--larger.d-marginRight--20").innerText ?? ''; | |
var listingLP = document.querySelector('.d-mega.d-fontWeight--bold.d-fontSize--larger.d-marginLeft--20').innerText ?? ''; | |
var listingAgentName = document.querySelector('td.d94m49').innerText ?? ''; | |
var listingAgentFirstName = listingAgentName.split(' ')[0] | |
var listingAgentLastName = listingAgentName.split(' ')[1] | |
var listingAgentPhone = document.querySelectorAll('table.d94m50 td.d94m52')[0].innerText ?? ''; | |
var listingAgentMobile = document.querySelectorAll('table.d94m50 td.d94m52')[1] ? document.querySelectorAll('table.d94m50 td.d94m52')[1].innerText : ''; | |
var listingAgentOffice = document.querySelectorAll('table.d94m50 td.d94m52')[2] ? document.querySelectorAll('table.d94m50 td.d94m52')[2].innerText : ''; | |
var listingAgentEmail = document.querySelector('a[href^="mailto:"]').innerText ?? ''; | |
var listingOfficeName = document.querySelectorAll('.d94m46')[1].querySelector('.formula.wrapped-field').innerText ?? ''; | |
var listingDescriptionSection = Array.from(document.querySelectorAll('table.d57m2 .heading2.d57m24')).filter(header => header.innerText.includes("Public Remarks")) | |
var listingDescription = ''; | |
if (listingDescriptionSection && listingDescriptionSection[0]) { | |
listingDescription = listingDescriptionSection[0].closest('tr').nextElementSibling.nextElementSibling.innerText | |
} | |
google_sheets_add_row( | |
"1Y2-9AhJZY2hgHIdRcxFajOR-KA-0nGzXeQKJMkXTfEk", | |
/*name*/'Sheet7', | |
[ | |
listingAddress, | |
listingLP, | |
listingAgentName, | |
listingAgentFirstName, | |
listingAgentLastName, | |
listingAgentPhone, | |
listingAgentMobile, | |
listingAgentOffice, | |
listingAgentEmail, | |
listingOfficeName, | |
listingDescription | |
] | |
); | |
var nextButton = document.querySelector('.pagingLinks a:nth-child(2)'); | |
nextButton.click(); | |
}, i * 3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment