This script checks for earlier available appointment dates on the US Non-immigrant Visa appointment setting website for Ethiopia.
Note: If you are using it for another country, follow the instructions in the Customization section.
- Log in to US Visa Appointment.
- Click on the "Continue" button to go to the actions page.
- Open the Console on your browser (usually F12 or right-click -> Inspect -> Console).
- Copy and paste the provided script into the console and press Enter to run it.
The script will run every 60 seconds, checking for earlier appointment dates than the specified desired date. If an earlier date is found, the script will display an alert with the earliest available date.
To adapt this script for another country:
- Inspect the network calls in your browser while on the reschedule appointment page.
- Look for an XHR call similar to
19.json?appointments[expedite]=false
. Replace19
with the appropriate visa center code for your country. - Replace
en-et
in the URLhttps://ais.usvisa-info.com/en-et/niv/schedule/
with your country's code (e.g.,en-us
for the USA).
Modify the desired date by changing the following line in the script:
const desiredDate = new Date('2024-04-30');
You can adjust how often the script checks for new appointments by modifying the interval in minutes:
const scrapeInterval = setScrapeInterval(1); // Check every 1 minute
Copy and paste the following script into the browser console:
'use strict';
// Desired date to find any earlier appointments (yyyy-mm-dd format)
const desiredDate = new Date('2024-04-30');
// Audio and Notification setup
const audioSource = 'https://cdn.freesound.org/previews/533/533869_5828667-lq.mp3';
const audio = new Audio(audioSource);
// Extract appointment ID from URL path
const getAppointmentId = () => {
const pathSegments = window.location.pathname.split('/');
return pathSegments[4];
};
const appointmentId = getAppointmentId();
const intervalInMinutes = 1;
// Notify user with audio and desktop notification
const notifyUser = async (message) => {
await audio.play();
if (!("Notification" in window)) {
alert("This browser does not support desktop notifications.");
} else if (Notification.permission === "granted") {
new Notification(message);
} else if (Notification.permission !== "denied") {
const permission = await Notification.requestPermission();
if (permission === "granted") {
new Notification(message);
}
}
};
// Check for available appointments and notify user if an earlier date is found
const checkAppointments = setInterval(function () {
$.getJSON('https://ais.usvisa-info.com/en-et/niv/schedule/' + appointmentId + '/appointment/days/19.json?appointments[expedite]=false', function (data) {
if (data.length === 0) { console.log('No appointments available'); }
if (data.length > 0) {
const earliestDate = new Date(data[0].date);
if (earliestDate.getTime() <= desiredDate.getTime()) {
// window.alert('Earliest date available: ' + earliestDate.toDateString());
// if you're busy using another window and would like to be notified if an appointment is found,
// comment the line above and uncomment the line below
notifyUser('Earliest date available: ' + earliestDate.toDateString());
} else {
console.log('No date available');
}
}
});
}, 60*1000*intervalInMinutes);
- Ensure your browser supports desktop notifications.
- You can replace
window.alert
withnotifyUser
for desktop notifications by uncommenting the relevant line in the script. - This script uses
fetch
for making network requests andasync/await
for asynchronous operations, ensuring modern and clean code practices.