Last active
October 14, 2018 09:02
-
-
Save t510599/310e1087987f4385da10c6a27accd341 to your computer and use it in GitHub Desktop.
Getting image urls of an instagram post
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
len = (document.querySelector('._6CZji .coreSpriteRightChevron')) ? document.querySelectorAll('div.tN4sQ li._-1_m6').length : 1 | |
index = 1 | |
timer = setInterval(doing,500) | |
urls = [] | |
function doing() { | |
imgs = document.querySelectorAll('._97aPb img') | |
if (index == 1){ | |
urls.push(imgs[0].getAttribute('src')) | |
} else { | |
urls.push(imgs[1].getAttribute('src')) | |
} | |
btn = document.querySelector('._6CZji .coreSpriteRightChevron') | |
if (btn) { | |
btn.click() | |
} | |
if(index == len) { | |
clearInterval(timer) | |
} else { | |
index++ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment