Last active
July 8, 2018 20:37
-
-
Save tinacious/724490e47af93eeb3959720b9e5ef5f5 to your computer and use it in GitHub Desktop.
๐ธ IG Download bookmarklet
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
/** | |
* When on Instagram web, after clicking the image, a modal pops up. | |
* Running this when the modal is open will work to grab the photo, | |
* which will be the last photo in the DOM. | |
* If you get to an IG photo page and the modal is not open, this won't work. | |
* To use as a bookmarklet, copy this code, create a new bookmark, & paste it after: | |
* javascript: | |
*/ | |
(function () { | |
const images = document.querySelectorAll('img'); | |
const imageCount = images.length; | |
const enlargedImageIndex = imageCount - 1; | |
const enlargedImage = images[enlargedImageIndex]; | |
const srcs = enlargedImage.getAttribute('srcset'); | |
const imgSrc = srcs.split(',')[2].split('?')[0]; | |
window.open(imgSrc); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment