Skip to content

Instantly share code, notes, and snippets.

@idolpx
Last active January 29, 2025 22:52
Show Gist options
  • Save idolpx/6cc02a477f4673e4aba7cbb5c4e1234f to your computer and use it in GitHub Desktop.
Save idolpx/6cc02a477f4673e4aba7cbb5c4e1234f to your computer and use it in GitHub Desktop.
Instagram Media Deprotect - Removes elements protecting images & videos from download
// ==UserScript==
// @namespace https://gist.github.com/idolpx
// @name Instagram Media Deprotect
// @version 1.0.5
// @description Removes elements protecting images & videos from download
// @downloadURL https://openuserjs.org/install/idolpx/Instagram_Media_Deprotect.user.js
// @updateURL https://openuserjs.org/meta/idolpx/Instagram_Media_Deprotect.meta.js
// @author Jaime Idolpx
// @copyright 2020, idolpx (https://openuserjs.org/users/idolpx)
// @license MIT
// @match https://www.instagram.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==
function remove_protection() {
$('article:visible').each(function() {
$(this).find('img').parent().next().remove();
if($(this).find('video').length > 0 && $(this).find('div.dl').length == 0) {
var src = $(this).find('video').attr('src');
var name = $(this).find('h2').first().text() + '-' + src.split("/").pop();
var html = '<div class="dl" style="text-align: center;font-size: large;font-weight: 900;"><a href="' + src + '" target="_blank" download="' + name + '">>>> Download Video <<<</a></div>';
$(this).find('header').next().after(html);
}
});
}
(function() {
'use strict';
remove_protection();
$('body').on("click",function(){
remove_protection();
});
$(window).scroll(function() {
clearTimeout($.data(this, 'scrollTimer'));
$.data(this, 'scrollTimer', setTimeout(function() {
remove_protection();
}, 250));
});
})();
@idolpx
Copy link
Author

idolpx commented Jan 29, 2025

I just tried the latest nightly of Firefox as well as the release version 134.0 on Windows and OSX and the script is still functioning correctly.

In the latest Chrome you now have to enable "Developer mode" for it to work. https://www.tampermonkey.net/faq.php#Q209

You may have another addon interfering. You could try disabling other addons. Or see if it works in Chrome or Brave.

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