Skip to content

Instantly share code, notes, and snippets.

@coolov
Last active April 6, 2021 17:23
Show Gist options
  • Save coolov/27a9b988d272f165164deae7b254ccd4 to your computer and use it in GitHub Desktop.
Save coolov/27a9b988d272f165164deae7b254ccd4 to your computer and use it in GitHub Desktop.
checks for appointments on the vax4nyc.nyc.gov "schedule an appointment screen"
// based on this awesome script
// https://gist.github.com/saranrapjs/f8700e33332ae4a13a931e761fc262a7
(function check() {
// they have hijacked document.querySelector/getElementById/etc but not document.all
Array.from(document.all).filter(el => el.nodeName.toLowerCase() === 'lightning-button-icon')[0].click();
setTimeout(() => {
Array.from(document.all).filter(el => el.name === 'today')[0].click();
setTimeout(() => {
const txt = Array.from(document.all).filter(el => el.className === 'appointment-section')[0].textContent;
// ignore these appointments
const none = /check back/.test(txt) ||
/Bronx/.test(txt) ||
/Beach Channel/.test(txt) ||
/Staten Island/.test(txt);
if (none && !window.stoppy) {
// check again
setTimeout(check, 1000);
} else {
// print the appointments to the console
console.log(txt);
// select the first slot
Array.from(document.all).filter(el => el.tagName === 'LIGHTNING-FORMATTED-TIME')[0].click()
// immediately click the next button
Array.from(document.all).filter(el => el.className === 'slds-button slds-button_brand')[0].click();
}
}, 500)
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment