-
-
Save AdySan/c0ef826eff3d40bb1c2df9ddf1b543f8 to your computer and use it in GitHub Desktop.
Download Tadpoles Media
This file contains 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
// Step 1: Open https://www.tadpoles.com/parents and log in; | |
// Step 2: Select the 'all' tab (IMPORTANT STEP); | |
// Step 3: Select a month; | |
// Step 4: Open the JavaScript console in your browser (e.g., press | |
// Command + Alt + i in Google Chrome on a Mac, or press | |
// Ctrl + Shift + i in Google Chrome in Windows); | |
// Step 5: Copy this entire code snippet, paste it to the JavaScript console, | |
// and press Enter to run; all photos and videos will be downloaded | |
// to your default Downloads folder and they should have proper | |
// file names. | |
// | |
// Repeat Steps 3 and 5 to download photos and videos for another month. | |
// | |
// Optional: Use 'on', 'start', and 'end' global variables. | |
(function() { | |
var e = document.createElement('script'); | |
e.src = 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js'; | |
e.type = 'text/javascript'; | |
document.getElementsByTagName('head')[0].appendChild(e); | |
var run = function(callback) { | |
if (window.jQuery) { | |
callback(jQuery); | |
} else { | |
window.setTimeout(function() { run(callback); }, 100); | |
} | |
}; | |
function sleep(milliseconds) { | |
var start = new Date().getTime(); | |
for (var i = 0; i < 1e7; i++) { | |
if ((new Date().getTime() - start) > milliseconds){ | |
break; | |
} | |
} | |
}; | |
run(function($) { | |
var year = ''; | |
$('.tile.pointable:not([id])').each(function() { | |
if ($(this).attr('style') === 'background-color: rgb(250, 167, 50);') { | |
year = $(this).find('span').text().slice(3, 7); | |
} | |
}); | |
var date = '', seq = 0; | |
$($('.tile.pointable[id]').get().reverse()).each(function() { | |
var s = $(this).find('.center h2 span'); | |
if (s.length > 0) { | |
date = year + '-' + s.text().split('/').map(padToTwo).join('-'); | |
seq = 1; | |
return; | |
} | |
var style = $(this).attr('style'); | |
if (typeof style === typeof undefined || style === false) { | |
return; | |
} | |
var url = style.replace('background-image: url("', '') | |
.replace('thumbnail=true&', '') | |
.replace('");', ''); | |
var basename = date + '-' + padToTwo(String(seq)), | |
ext = $(this).find('.play-icon').length > 0 ? 'mp4' : 'jpg'; | |
if (typeof on !== typeof undefined && date != on) { | |
return; | |
} | |
if (typeof on === typeof undefined && typeof start !== typeof undefined && basename < start) { | |
return; | |
} | |
if (typeof on === typeof undefined && typeof end !== typeof undefined && basename > end) { | |
return; | |
} | |
var e = document.createElement('a'); | |
e.href = url; | |
e.download = basename + '.' + ext; | |
document.body.appendChild(e); | |
e.click(); | |
document.body.removeChild(e); | |
sleep(1000); | |
seq += 1; | |
}); | |
function padToTwo(s) { | |
return s.length >= 2 ? s : Array(2 - s.length + 1).join('0') + s; | |
} | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment