Skip to content

Instantly share code, notes, and snippets.

@stripedpurple
Last active January 5, 2021 17:43
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 stripedpurple/4a0dcbb8a2511fb6e1b59fe38c799ffa to your computer and use it in GitHub Desktop.
Save stripedpurple/4a0dcbb8a2511fb6e1b59fe38c799ffa to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Instagram Downloader
// @namespace http://stripedpurple.io
// @version 2018.12.29.2
// @description Download images from instagram. This was created so that I can test lightroom presets and LUTs on existing photos.
// @author Austin Barrett
// @match *://www.instagram.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
var newStyle = document.createElement('style');
newStyle.innerHTML = '._9AhH0 { pointer-events: none;}';
document.head.appendChild(newStyle);
var oldDownloadLink = "";
function downloader() {
var imgElem = document.querySelectorAll('article.M9sTE.L_LMM .FFVAD')[0];
var downloadLink = imgElem.currentSrc;
imgElem.srcset.split(',').forEach(function (d) {
var e = d.split(' ');
if (e[1] == '1080w') {
downloadLink = e[0];
}
});
if (oldDownloadLink !== downloadLink) {
var oldElem = document.getElementById('downloaderBtnFTW')
if (oldElem !== null) {
oldElem.parentNode.removeChild(oldElem);
}
var downloadBtn = document.createElement('span');
downloadBtn.id = 'downloaderBtnFTW';
downloadBtn.innerHTML = '<button class="dCJp8 afkep _0mzm-"><a href="' + downloadLink + '" download target="_blank"><img width="32px" src="https://i.imgur.com/qyt2rL0.png"></a></button>';
document.querySelectorAll('section.ltpMr.Slqrh')[0].appendChild(downloadBtn);
oldDownloadLink = downloadLink;
}
}
setInterval(downloader, 500)
})();
@Korb
Copy link

Korb commented Jan 5, 2021

Под Firefox 85.0b4 (64-bit) и Tampermonkey 4.11.6120 - работает, под Firefox 84.0.1 x64 - нет.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment