Skip to content

Instantly share code, notes, and snippets.

@powerwlsl
Created July 8, 2023 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save powerwlsl/2bb3f1d6d3a05500dca6832cb7077b02 to your computer and use it in GitHub Desktop.
Save powerwlsl/2bb3f1d6d3a05500dca6832cb7077b02 to your computer and use it in GitHub Desktop.
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.querySelectorAll("td.d128m16 .formula.field.d128m15")[0].innerText ?? '';
var listingLP = document.querySelector('tr.d128m13 td.d128m11').innerText ?? '';
var listingOLP = document.querySelectorAll('td.d128m11')[2].innerText ?? '';
var listingDescription = document.querySelectorAll('tr.d139m6')[0].querySelector('td.d139m4').innerText ?? '';
var listingAgentAddress = document.querySelectorAll('tr.d141m10')[0].querySelector('td.d141m4').innerText ?? '';
var listingOfficeName = listingAgentAddress.split(/[\(\)]/)[0].trim() ?? '';
var listingOfficeNumber = listingAgentAddress.split(/[\(\)]/)[1].trim() ?? '';
var listingOfficePhoneNumber = listingAgentAddress.split(/[\(\)]/)[2].trim() ?? '';
var listingOfficeAddress = document.querySelectorAll('tr.d141m10')[1].querySelector('td.d141m4').innerText ?? '';
var listingAgentInfo = document.querySelectorAll('tr.d141m10')[2].querySelector('td.d141m4').innerText ?? '';
var listingAgentName = listingAgentInfo.split(/[\(\)]/)[0].trim() ?? '';
var listingAgentFirstName = listingAgentName.split(" ")[0] ?? '';
var listingAgentLastName = listingAgentName.split(" ")[1] ?? '';
var listingAgentLicenseNumber = listingAgentInfo.split(/[\(\)]/)[1].trim() ?? '';
var listingAgentPhoneNumber = listingAgentInfo.split(/[\(\)]/)[2].trim() ?? '';
var listingAgentEmail = document.querySelectorAll('tr.d141m10')[3].querySelector('td.d141m4').innerText ?? '';
var listingAgentLACell = document.querySelectorAll('tr.d141m10 td.d141m6')[1].innerText
var listingAgentLACell2 = document.querySelectorAll('tr.d141m10 td.d141m6')[2].innerText
google_sheets_add_row(
"1Y2-9AhJZY2hgHIdRcxFajOR-KA-0nGzXeQKJMkXTfEk",
/*name*/'Sheet2',
[
listingAddress,
listingLP,
listingOLP,
listingDescription,
listingOfficeName,
listingOfficeNumber,
listingOfficePhoneNumber,
listingOfficeAddress,
listingAgentName,
listingAgentFirstName,
listingAgentLastName,
listingAgentLicenseNumber,
listingAgentPhoneNumber,
listingAgentEmail,
listingAgentLACell,
listingAgentLACell2
]
);
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