Last active
January 4, 2016 04:18
-
-
Save davidglezz/8567290 to your computer and use it in GitHub Desktop.
Tuenti Photo Downloader Script :: Script que automatiza el navegador y guarda las fotos de la red Social Tuenti con nombre de la fecha en que fueron subidas. ¿Como se usa? Abre un album de fotos, Pulsa F12 dirígete a la pestaña consola, pega el script y pulsa "Enter". Ahora no toque nada, las fotos irán pasando solas y descargándose.
Probablemen…
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
var elementoFoto = null, urlFotoActual = "", urlFotoAnterior = "", intervalo = null, fechaAnt = '', dCont = 0; | |
function intervalDescargarFoto() | |
{ | |
try { | |
elementoFoto = document.getElementById("photo_image"); | |
urlFotoActual = elementoFoto.getAttribute("src"); | |
if (urlFotoActual != urlFotoAnterior) | |
return; | |
urlFotoAnterior = urlFotoActual; | |
var fecha = document.querySelector("#photo_basic em.h-date").innerText; | |
var d = new Date(fecha); | |
if (fechaAnt == fecha) | |
{ | |
d.setSeconds(++dCont); | |
} | |
else | |
{ | |
dCont = 0; | |
} | |
fechaAnt = fecha; | |
var nombre = d.getFullYear() + '-'; | |
var t = d.getMonth(); | |
nombre += (t < 10 ? ('0' + t) : t) + '-'; | |
t = d.getDate(); | |
nombre += (t < 10 ? ('0' + t) : t) + ' '; | |
t = d.getHours(); | |
nombre += (t < 10 ? ('0' + t) : t) + '.'; | |
t = d.getMinutes(); | |
nombre += (t < 10 ? ('0' + t) : t) + '.'; | |
t = d.getSeconds(); | |
nombre += (t < 10 ? ('0' + t) : t) + '.jpg'; | |
var enlace = document.createElement("a"); | |
enlace.href = urlFotoActual; | |
enlace.download = nombre; | |
enlace.target = "_blank"; | |
var evento = document.createEvent("Event"); | |
evento.initEvent("click", true, true); | |
enlace.dispatchEvent(evento); | |
(window.URL || window.webkitURL).revokeObjectURL(enlace.href); | |
console.log("Foto descargada: " + nombre + " [" + urlFotoActual + "]"); | |
if (document.getElementById("album_progress_bar").style.width == "100%") | |
{ | |
clearInterval(intervalo); | |
alert("Terminado"); | |
} | |
else | |
{ | |
document.getElementById("photo_nav_next").dispatchEvent(evento); | |
} | |
} catch(e) { | |
console.log("ERROR: " + e); | |
} | |
} | |
//Intervalo de ejecucion | |
intervalo = setInterval(intervalDescargarFoto, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment