ZocDoc Covid Vaccine Script

This script helps you book a covid vaccine appointment on Zocdoc

目前為 2021-04-06 提交的版本,檢視 最新版本

// ==UserScript==
// @name         ZocDoc Covid Vaccine Script
// @namespace    https://gf.qytechs.cn/users/754006
// @version      1.0
// @description  This script helps you book a covid vaccine appointment on Zocdoc
// @author       Antoine Carpentier
// @match        https://www.zocdoc.com/*
// @grant        none
// ==/UserScript==

function Vaccine()
{
    console.log("Initiating Script.")
    var loaded = document.getElementsByClassName("htzklx-11 hskUir")[0];

    if (loaded)
    {
        console.log ("Location list loaded.")

        var bookinglocation = document.getElementsByClassName("yglqz4-2 fNAZIY sc-32axb7-4 jRvRQu")[0]; //location button
        if (bookinglocation)
        {
            console.log("Found a location.")
            bookinglocation.click();

            BookingTime();
        }
        else
        {
            console.log("No available location. Refreshing page.")
            setTimeout(function(){location.reload()}, 1500);
        }
    }
    else
    {
        var fbbutton = document.getElementsByClassName("Button__StyledButton-yglqz4-2 iAUbwA BaseSocialLoginButtonTransparent__StyledButton-rwqyb7-2 uExfa FacebookLoginButtonTransparent__StyledLoginButton-sc-1rfzugu-1 bpqSZg PatientInfoPageView__StyledFacebookLoginButton-iezlhj-2 bsRKPK")[0]
        if (fbbutton)
        {
            console.log("Logging into Facebook.")
            fbbutton.click()
        }
        else
        {
            var noavailability = document.getElementsByClassName("NoAvailabilityView__NoAvailabilityText-sc-54izdc-0 kmDGZM")[0]
            if (noavailability && noavailability.innerText == "No upcoming appointments available.")
            {
                console.log("Appointment no longer available. Back to the location list.");
                setTimeout(function(){location.replace("https://www.zocdoc.com/vaccine/search/IL?flavor=state-search");},1000);
            }
            else
            {
                var radiobutton = document.getElementsByClassName("textbox__Input-f9jwpk-1 ieYGhk exclude-from-playback")[6]
                if (radiobutton)
                {
                    document.getElementsByClassName("Radio__RadioContainer-sc-12d437a-5 jZkvmS YesNoRadioGroup__StyledRadio-sc-1g3yb7j-0 dkcNqu")[0].click()
                    document.getElementsByClassName("Radio__RadioContainer-sc-12d437a-5 jZkvmS YesNoRadioGroup__StyledRadio-sc-1g3yb7j-0 dkcNqu")[2].click()
                    document.getElementsByClassName("Radio__RadioContainer-sc-12d437a-5 jZkvmS YesNoRadioGroup__StyledRadio-sc-1g3yb7j-0 dkcNqu")[4].click()

                    document.getElementsByClassName("textbox__Input-f9jwpk-1 ieYGhk exclude-from-playback")[6].value = "None";
                    var event = new Event('input', { bubbles: true });
                    document.getElementsByClassName("textbox__Input-f9jwpk-1 ieYGhk exclude-from-playback")[6].dispatchEvent(event);
                    setTimeout(function(){document.getElementById("BookApptButton").click()},1000);
                    console.log("Finalizing booking");

                    setTimeout(Vaccine,1000);
                }
                else
                {
                    setTimeout(Vaccine,1000);
                }
            }
        }
    }
}

Vaccine();


function BookingTime()
{
    var loadedbookingtime = document.getElementsByClassName("sc-14oxdvn-0 kt5wwf-1 kBYZZr")[0]
    if (loadedbookingtime)
    {
        var availableappointment = document.getElementsByClassName("cuhhzo-3 gMYWbC skiptranslate")[0];
        if (availableappointment)
        {
            console.log("Appointment available at selected location!");
            availableappointment.click();
        }
        else
        {
            console.log("No available appointments at selected location - Refreshing page.")
            location.reload();
        }
    }

    else
    {
        setTimeout(BookingTime,500);
    }
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址