Skip to content

Instantly share code, notes, and snippets.

@nicksteffens
Last active March 30, 2021 18:50
Show Gist options
  • Save nicksteffens/dfd9eb823f4337acd87c2122272ad0b9 to your computer and use it in GitHub Desktop.
Save nicksteffens/dfd9eb823f4337acd87c2122272ad0b9 to your computer and use it in GitHub Desktop.
  • Navigate to https://vax4nyc.nyc.gov/patient/s/vaccination-schedule
  • Fill out the "Eligibility" form
    1. Check " New York City residents ages 30 or older"
    2. "No" you're not NYC employee
    3. Fill in DoB
    4. Fill in Zip
    5. "yes" Certify live in NYC
    6. click Next
  • Fill in "Health Screening And attestation
    1. "no" for allergic reaction
    2. Fill in Full Name
    3. Check hereby certify...
    4. Check and Complete reCatcha
    5. Click Next
  • Open the browsers console by right-clicking and selecting inspect
  • paste the following into the console tab
async function bookAppointment(zip = 10013) {
    const $ = window.$;
    const $$ = window.$$;
    function wait(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
    }
    while(true) {
        // Fill in zip
        const zipField = $("[name='zipCodeValue']");
        zipField.value = "";
        zipField.value = zip;
        console.log("searching");
        // Wait for appt request.
        await wait(1000);
        const appointmentSlot = $(".appointment_slot .panel-heading");
        const next = $$('button').find((button) => button.id.includes("skipToNext"));
        if (appointmentSlot) {
            // Log appointment info.
            console.warn("INFO", $('.page-content').textContent);
            console.warn("TIME", $('lightning-formatted-time').innerText);
            appointmentSlot.click();
            next.click();
            await wait(1000);
            // If find another appointment button pops up, it's gone. Try again.
            const findAnotherAppt = $('[title="Find Another Appointment"]');
            if (findAnotherAppt) {
                findAnotherAppt.click();
                await wait(1000);
            } else {
                return alert("Appointment found!");
            }
        }
    }
}
bookAppointment();
  • Allow script to run until the "Appointment Found!" aleart window pops up
  • Click Previous
  • Verify the appointment is Viable
    1. Time / Date
    2. Location

if NOT APPROPRIATE start the process over

if APPROPRIATE click NEXT

  1. fill out form
  2. Do appointment pre-reqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment