Last active
December 16, 2019 22:45
-
-
Save yongheng/adeaf4ac496715131c4e98633706812c 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); | |
} | |
}; | |
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); | |
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
Hello,
thank you for the script - it's awesome.
As mentioned by @kevinmbowen, I'm also only able to download 10 images; I tried using the updated script with start/end but due to my limited skills wasn't able to.
Then found modified script from "rickscherer" and tried it; it worked !
https://gist.github.com/rickscherer/c9424372b22a09501caf7b1f10a28760
Thank you all.