Created
March 13, 2021 06:31
-
-
Save alanzchen/fa7d2f526a24ea9aa51b0ccb2e254d9c to your computer and use it in GitHub Desktop.
Get Tumblr Hires Images Markdown in Editor
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
// step 1: | |
var figs = document.getElementsByTagName('figure'); | |
var imgs = []; | |
for (var i = 0; i < figs.length; i++) { | |
try { | |
var l = figs[i].childNodes[0].childNodes[0].srcset.split(' ') | |
var s = l[l.length-2]; | |
imgs.push(s); | |
var s = '' | |
console.log(s) | |
} catch { | |
console.log(figs[i]) | |
console.log('Not on screen? Pls scroll down and run this again!') | |
} | |
} | |
// step 2: after you scrolled down | |
imgs = imgs.reduce(function(a,b){if(a.indexOf(b)<0)a.push(b);return a;},[]); | |
console.log(`${imgs.length} images:`) | |
for (var i = 0; i < imgs.length; i++) { | |
console.log(imgs[i]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment