Last active
May 26, 2021 09:38
-
-
Save mrhorse/0ed32232b9c2e36ba52e0117757eb632 to your computer and use it in GitHub Desktop.
Horse vaccine script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name CV-19 Vaccine Appointment Helper | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @author Horse | |
// @match https://www.nhs.uk/book-a-coronavirus-vaccination/book/Appointment/* | |
// @grant none | |
// @require https://code.jquery.com/jquery-3.6.0.slim.js | |
// ==/UserScript== | |
(function($) { | |
'use strict'; | |
var refresh_secs = 1; | |
var min_distance = 10; | |
var doReload = function(){ | |
setTimeout(function(){ location.reload(); }, refresh_secs*1000); | |
}; | |
var criteria_met = false; | |
// Site listing. | |
if ($('.site-list').length) { | |
$('.results__item').each((i, el) => { | |
var distance = $(el).find('p.distance').text().replace(' Miles away', ''); | |
distance = parseFloat(distance); | |
if (distance < min_distance) { | |
criteria_met = true; | |
$(el).find('h3 a').click(); | |
} | |
}); | |
if (!criteria_met) { | |
doReload(); | |
} | |
} | |
// Chosen a site. Reload available dates. | |
if ($('.NoAvailableSlotsForSite').length) { | |
doReload(); | |
} | |
if ($('.AppointmentDate1').length || $('.AppointmentDate2').length) { | |
$('.nhsuk-radios__item').each((i, el) => { | |
var label = $(el).find('label').text(); | |
if (label.search('AM - Available') > -1 || label.search('PM - Available') > -1) { | |
criteria_met = true; | |
$(el).find('input.nhsuk-radios__input').click(); | |
$(el).closest('form').submit(); | |
} | |
}); | |
if (!criteria_met) { | |
doReload(); | |
} | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions:
https://www.nhs.uk/book-a-coronavirus-vaccination/book/Appointment/
Now. Start the appointment booking process. Firstly, right click the webpage and click 'Inspect' - keep the dev tools open throughout the process for the tab you're attempting to book the appointment through.
When you get to the list of sites turn the script on and refresh the page. The page will keep refreshing till it finds a center < 10mi away. When you find the one you want (typically Ashton Gate) click it and don't head back to the site listing page - stay on the page for Ashton gate. It'll keep refreshing until there's an available slot, then once an available slot appears it will instantly move you to the next page for the first available option. Now it's up to you to see this and submit the time you want and move to the next step - the speed the script moves you to the 'select a slot' page already gives you a time advantage, but you still need to be quick. If you miss the slot, go back to the 'Choose a date' page for that site and keep refreshing - it's a numbers game but you'll get there.
If the script starts refreshing or acting up on pages it shouldn't be - disable it via the toggle in the tampermonkey plugin icon's context menu.