Skip to content

Instantly share code, notes, and snippets.

@rodrigolopezguerra
Created February 16, 2022 18:58
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rodrigolopezguerra/97c4a2c240c08efc27dd5425c6cdc13e to your computer and use it in GitHub Desktop.
Save rodrigolopezguerra/97c4a2c240c08efc27dd5425c6cdc13e to your computer and use it in GitHub Desktop.
function checkAvailability() {
var options = {
"method" : "GET",
};
try {
var i;
var url = "https://www.cgeonline.com.ar/informacion/apertura-de-citas.html";
var result = UrlFetchApp.fetch(url,options);
var response = result.getContentText("iso-8859-1");
var start = "<table"
var end ="</table>"
var response = response.substring(response.indexOf(start)+start.length, response.indexOf(end));
response = response.split("<tr>");
for(i=0;i<response.length;i++) {
r = response[i];
if(r.indexOf("y primera vez") > -1) {
a = r.split("<td>");
if(a[3].indexOf("fecha por confirmar") > -1){
} else {
var mail = "rodrigolopezguerra@gmail.com"
var asunto = "MONITOR CITAS ES PASAPORTE - SACAR TURNO URGENTE! "+new Date();
var mensaje = "Saca urgente desde la compu renovación para el pasaporte de TONI que los turnos tienen ventanas y duran menos de 1 hora: https://www.cgeonline.com.ar/tramites/citas/opciones-pasaporte.html / \n \n";
GmailApp.sendEmail(mail,asunto,mensaje)
}
}
}
}
catch (e) {
Logger.log(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment