Created
December 21, 2023 21:21
-
-
Save erseco/a526098b82d573391bb2b533b0e72e11 to your computer and use it in GitHub Desktop.
Comprobador loteria navidad 2023 con la web de rtve en javascript
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
// | |
// Comprobador de la loteria de navidad | |
// | |
// Ve a https://www.rtve.es/loterias/loteria-navidad/buscador/ abre la consola javascript del navegador y pega este código | |
// | |
// Lista de números y cantidades | |
const numeros = [ | |
{ numero: "12345", cantidad: "20" }, | |
{ numero: "54321", cantidad: "1" }, | |
// ... Añade más números y cantidades (sin decimales) aquí | |
]; | |
function comprobarNumero(indice) { | |
if (indice >= numeros.length) { | |
console.log("Comprobación finalizada."); | |
return; | |
} | |
const numero = numeros[indice].numero; | |
const cantidad = numeros[indice].cantidad; | |
document.getElementById("numero_sorteo_navidad").value = numero; | |
document.getElementById("cantidad_sorteo_navidad").value = cantidad; | |
document.getElementById("submit_buscar_decimos_navidad").click(); | |
// Esperar a que la página muestre el resultado | |
setTimeout(() => { | |
const resultado = document.querySelector("#total_navidad"); | |
if (resultado && resultado.textContent.includes("Lo sentimos ...")) { | |
console.log(`El número ${numero} no ha sido premiado.`); | |
} else { | |
console.log(`¡El número ${numero} puede haber sido premiado!`); | |
} | |
// Continuar con el siguiente número después de un breve retraso | |
setTimeout(() => comprobarNumero(indice + 1), 1000); | |
}, 3000); // Ajusta este tiempo según sea necesario | |
} | |
// Iniciar la comprobación | |
comprobarNumero(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment