Skip to content

Instantly share code, notes, and snippets.

@t510599
Last active October 14, 2018 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t510599/310e1087987f4385da10c6a27accd341 to your computer and use it in GitHub Desktop.
Save t510599/310e1087987f4385da10c6a27accd341 to your computer and use it in GitHub Desktop.
Getting image urls of an instagram post
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