-
-
Save yongheng/adeaf4ac496715131c4e98633706812c to your computer and use it in GitHub Desktop.
// 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; | |
} | |
}); | |
}()); |
mp4 videos worked for me. However, for me; when I run the script it only downloads 1 DAY within the month. Did yours download all of the days in the month?
@AdySan The last time I used this script was 15 months ago. It was able to download mp4 videos at that time.
@kevinmbowen It seems Tadpoles only allows me to download 10 images/videos at a time. I suspect adding sleeps between requests will solve this problem, but I'm not going to do that because I find myself rarely needs bulk downloads. Instead, I add functionality to enable using global variables on
, start
, and end
to specify date range, which will allow me to circumvent the bulk download limit and download all images/videos.
Works great for me. Thanks! Here's a bookmarklet version:
javascript:(function()%7Bvar%20e%20%3D%20document.createElement('script')%3Be.src%20%3D%20'https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Fjquery%2F2.2.4%2Fjquery.min.js'%3Be.type%20%3D%20'text%2Fjavascript'%3Bdocument.getElementsByTagName('head')%5B0%5D.appendChild(e)%3Bvar%20run%20%3D%20function(callback)%20%7Bif%20(window.jQuery)%20%7Bcallback(jQuery)%3B%7D%20else%20%7Bwindow.setTimeout(function()%20%7B%20run(callback)%3B%20%7D%2C%20100)%3B%7D%7D%3Brun(function(%24)%20%7Bvar%20year%20%3D%20''%3B%24('.tile.pointable%3Anot(%5Bid%5D)').each(function()%20%7Bif%20(%24(this).attr('style')%20%3D%3D%3D%20'background-color%3A%20rgb(250%2C%20167%2C%2050)%3B')%20%7Byear%20%3D%20%24(this).find('span').text().slice(3%2C%207)%3B%7D%7D)%3Bvar%20date%20%3D%20''%2C%20seq%20%3D%200%3B%24(%24('.tile.pointable%5Bid%5D').get().reverse()).each(function()%20%7Bvar%20s%20%3D%20%24(this).find('.center%20h2%20span')%3Bif%20(s.length%20%3E%200)%20%7Bdate%20%3D%20year%20%2B%20'-'%20%2B%20s.text().split('%2F').map(padToTwo).join('-')%3Bseq%20%3D%201%3Breturn%3B%7Dvar%20style%20%3D%20%24(this).attr('style')%3Bif%20(typeof%20style%20%3D%3D%3D%20typeof%20undefined%20%7C%7C%20style%20%3D%3D%3D%20false)%20%7Breturn%3B%7Dvar%20url%20%3D%20style.replace('background-image%3A%20url(%22'%2C%20'').replace('thumbnail%3Dtrue%26'%2C%20'').replace('%22)%3B'%2C%20'')%3Bvar%20basename%20%3D%20date%20%2B%20'-'%20%2B%20padToTwo(String(seq))%2Cext%20%3D%20%24(this).find('.play-icon').length%20%3E%200%20%3F%20'mp4'%20%3A%20'jpg'%3Bvar%20e%20%3D%20document.createElement('a')%3Be.href%20%3D%20url%3Be.download%20%3D%20basename%20%2B%20'.'%20%2B%20ext%3Bdocument.body.appendChild(e)%3Be.click()%3Bdocument.body.removeChild(e)%3Bseq%20%2B%3D%201%3B%7D)%3Bfunction%20padToTwo(s)%20%7Breturn%20s.length%20%3E%3D%202%20%3F%20s%20%3A%20Array(2%20-%20s.length%20%2B%201).join('0')%20%2B%20s%3B%7D%7D)%7D)()
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.
Sweet, worked like a charm. Are mp4 videos supposed to be downloaded too? that part doesn't seem to work.