Skip to content

Instantly share code, notes, and snippets.

@Kyle-Mendes
Last active March 18, 2021 20:33
Show Gist options
  • Save Kyle-Mendes/e21b735b2027f4a7246c974c4e51c547 to your computer and use it in GitHub Desktop.
Save Kyle-Mendes/e21b735b2027f4a7246c974c4e51c547 to your computer and use it in GitHub Desktop.
CVS Vaccine Finder
// Search CVS for available vaccines.
// Right click your page in Chrome (or other browsers)
// Open the console, paste this code, and hit enter.
// Must be run from the "Schedule Dose" page, after entering your Zip Code.
// This script will repeatedly search the CVS website for a vaccine appointment,
// and play the sound of an airhorn when an appointment is available.
// Make sure to have your speakers on!
function search() {
// Find the search button on the page
const button = document.getElementsByClassName('flex-button-search')[0];
// Click the button
button.click()
// Wait 5 seconds for search results to load
setTimeout(() => {
// Look to see if there are a list of stores with vaccines available.
const results = document.getElementsByClassName('store-list-info');
// If there aren't, wait 30 seconds and search again.
if (results.length === 0) {
console.log('no results');
setTimeout(search, 30000);
} else {
// If there ARE, play an airhorn (and log to the console)
console.log('results');
const audio = new Audio('https://www.myinstants.com/media/sounds/mlg-airhorn.mp3');
audio.play();
}
}, 5000);
}
// Run the search function.
search();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment