NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Insta Video Downloader
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Sangam
// @match https://www.instagram.com/*
// @grant none
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @license MIT
// ==/UserScript==
(function () {
'use strict';
// Your code here...
function checkForContent(selector) {
const tags = document.body.querySelectorAll(selector);
console.log(tags)
for (let i = 0; i < tags.length; i++) {
const tag = $(tags[i]);
console.log(tag.offset().top + tag.height() >= 0)
console.log(tag.offset().top <= window.innerHeight)
if (tag.offset().top + tag.height() >= 0 && tag.offset().top <= window.innerHeight) return tag.attr("src");
}
return null;
}
function getContentLink(e) {
return checkForContent("video source") || checkForContent("video");
}
function downloadVideo() {
const link = getContentLink();
if (link == null) return alert("No video found");
window.open(link)
}
const $body = $("body");
$body.append(`<div id="downloader-icon" draggable="true" style="position:fixed; bottom: 40px; right: 20px; background-image: linear-gradient(#f99a52,#db579d); font-weight:bold; color:white; cursor:pointer; z-index:100000; padding: 5px 10px; border-radius:5px; box-shadow: 0 0 5px black">Search & Download</div>`);
const $icon = $("#downloader-icon");
$icon.click(downloadVideo);
})();