Skip to content

Instantly share code, notes, and snippets.

@bokenator
Last active June 8, 2022 14:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bokenator/4ceb8b41d05debb318f3a649ac13b7ab to your computer and use it in GitHub Desktop.
Save bokenator/4ceb8b41d05debb318f3a649ac13b7ab to your computer and use it in GitHub Desktop.
/*
To use this script, do the following:
1. log in to https://ais.usvisa-info.com
2. Click on the "Continue" button to go to the actions page
3. Open up Console on your browser
4. Copy and paste this script into the console and press Enter to run the script
*/
'use strict';
// Enter the desired date (or earlier) in yyyy-mm-dd format
var desiredDate = new Date('2017-11-01');
var path = window.location.pathname,
id = path.split('/')[4];
var scrapeInterval = setInterval(function () {
$.getJSON('https://ais.usvisa-info.com/en-ca/niv/schedule/' + id + '/appointment/days/94.json?appointments[expedite]=false', function (data) {
var earliestDate = new Date(data[0].date);
if (earliestDate.getTime() <= desiredDate.getTime()) {
window.alert('Earliest date available: ' + earliestDate.toDateString());
} else {
console.log('Not available');
}
});
}, 10000);
@bokenator
Copy link
Author

bokenator commented Dec 12, 2021 via email

@blantlr
Copy link

blantlr commented Jun 3, 2022

Error message

VM60:11 Uncaught TypeError: Cannot read properties of undefined (reading 'date')
    at Object.success (<anonymous>:11:39)
    at i (application-a5d81146f0dbde092ba8335f14cb72458e9108c3ecbf8e570acf6ed419b76545.js:3:27449)
    at Object.fireWith [as resolveWith] (application-a5d81146f0dbde092ba8335f14cb72458e9108c3ecbf8e570acf6ed419b76545.js:3:28213)
    at y (application-a5d81146f0dbde092ba8335f14cb72458e9108c3ecbf8e570acf6ed419b76545.js:5:22721)
    at XMLHttpRequest.c (application-a5d81146f0dbde092ba8335f14cb72458e9108c3ecbf8e570acf6ed419b76545.js:5:26925)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment