From ae1c3cfe1b6e72ebdd4750459955f466cc4eb94e Mon Sep 17 00:00:00 2001 From: Sascha Heim Date: Tue, 1 Mar 2022 13:48:35 +0100 Subject: [PATCH] v10.1.2 Fix videos downloading --- README.md | 5 +- dist/main.js | 2 +- index.html | 4 +- lang/de-de/index.html | 4 +- lang/en-us/index.html | 4 +- lang/es-ar/index.html | 4 +- lang/pt-br/index.html | 4 +- package.json | 2 +- src/_langs/partials/button.html | 2 +- src/helpers/getBlobVideoUrl.ts | 167 ++++++++++++++------------------ src/modules/MediaScanner.ts | 10 +- 11 files changed, 93 insertions(+), 115 deletions(-) diff --git a/README.md b/README.md index a11a230..ef05939 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# [instantgram] v10.1.1 -![GitHub release](https://img.shields.io/badge/release-v10.1.1-green) +# [instantgram] v10.1.2 +![GitHub release](https://img.shields.io/badge/release-v10.1.2-green) ![badge](https://img.shields.io/badge/for-instagram-yellow.svg?style=flat-square) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/) @@ -39,6 +39,7 @@ With this version we support all modern browsers that have ECMAScript 2015 (es6) Read [CONTRIBUTING.md](CONTRIBUTING.md) for more information. :heart: ## Changelog +- v10.1.2 - [instangram] Fix issue #17 can't save most types of videos anymore. - v10.1.1 - [instangram] Fix profile page downloading doesn't work anymore. - v10.1.0 - [instangram] New image detection algorithm. Image with highest percent in feed and visible in viewport will be grabed by the scanner. - v10.0.6 - [instangram] Fix #15 Instantgram often grabs avatars/profile pics diff --git a/dist/main.js b/dist/main.js index f11fb8e..a5e3205 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1 +1 @@ -(()=>{"use strict";function e(e){return new Promise((function(t){setTimeout(t,e)}))}class t{constructor(e){if(this.modal=null,this.imageURL=e?.imageURL||"",this.heading=e?.heading||[""],this.headingStyle=e?.headingStyle||"",this.content=e?.content||[""],this.contentStyle=e?.contentStyle||"",this.buttonList=e?.buttonList||[],null==document.getElementById("instantgram-modal")){var t=document.createElement("style");t.id="instantgram-modal",t.innerHTML='.instantgram-modal-overlay{display:none!important;opacity:0!important;transition:all ease .1s!important;position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:1000!important;background:rgba(0,0,0,.65)!important;justify-content:center!important;align-items:center!important}.instantgram-modal{transition:width ease-in-out .1s!important;display:inline-block!important;width:400px!important;padding:1.6px!important;z-index:1001!important}.instantgram-modal select{margin-left:.8px!important;border:solid 1px #dbdbdb!important;border-radius:3px!important;color:#262626!important;outline:0!important;padding:3px!important;text-align:center!important}@media (min-width:736px){.instantgram-modal{width:500px!important}}.instantgram-modal-content{position:relative;display:flex;flex-direction:column;width:100%!important;pointer-events:auto!important;background-clip:padding-box!important;outline:0!important}.instantgram-modal-header{color:#fff!important;background-color:#fd1d1d!important;background-image:linear-gradient(45deg,#405de6,#5851db,#833ab4,#c13584,#e1306c,#fd1d1d)!important;border-top-left-radius:12px!important;border-top-right-radius:12px!important;padding:0 16px 0 16px!important}.instantgram-modal-header h5{color:#fff!important;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif!important;font-size:16px!important;margin:revert!important}.instantgram-modal-header h5:nth-child(2){margin-top:-15px!important;margin-bottom:20px!important}.instantgram-modal-body{background:#fff!important;position:relative!important;-webkit-box-flex:1!important;-ms-flex:1 1 auto!important;flex:1 1 auto!important;padding:16px!important}.instantgram-modal-body p{display:block!important;margin:revert!important;margin-block-start:1em!important;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif!important;font-size:16px!important}.instantgram-modal-footer{background-color:#fff!important;border-top:1px solid #dbdbdb!important;border-left:0!important;border-right:0!important;border-bottom-left-radius:12px!important;border-bottom-right-radius:12px!important;line-height:1.5!important;min-height:48px!important;padding:4px 8px!important;user-select:none!important;display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:center!important}.instantgram-modal-footer button{width:100%!important;min-height:39px!important;background-color:transparent!important;border:0!important;outline:0!important;cursor:pointer!important;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif!important;font-size:16px!important}.instantgram-modal-footer button.active{color:#0095e2!important}.instantgram-modal-show{opacity:1!important}.instantgram-modal-visible{display:flex!important}#instantgram-bulk-download-indicator{text-align:center!important}',document.head.appendChild(t)}}get element(){return this.modal}createModal(){const e=document.createElement("div");e.classList.add("instantgram-modal-overlay");const t=document.createElement("div");t.classList.add("instantgram-modal"),e.appendChild(t);const o=document.createElement("div");o.classList.add("instantgram-modal-content"),t.appendChild(o);const n=document.createElement("div");n.classList.add("instantgram-modal-header"),this.headingStyle.length>0&&n.setAttribute("style",this.headingStyle),o.appendChild(n),this.heading.forEach((e=>{if("string"!=typeof e||/<\/?[a-z][\s\S]*>/i.test(e))if(/<\/?[a-z][\s\S]*>/i.test(e)){let t,o=document.createElement("div"),a=document.createDocumentFragment();for(o.innerHTML=e;t=o.firstChild;)a.appendChild(t);n.appendChild(a)}else n.appendChild(e);else{const t=document.createElement("h5");t.innerHTML=e,n.appendChild(t)}}));const a=document.createElement("div");if(a.classList.add("instantgram-modal-body"),this.contentStyle.length>0&&a.setAttribute("style",this.contentStyle),o.appendChild(a),this.imageURL.length>0){const e=document.createElement("div");o.appendChild(e);const t=document.createElement("img");t.setAttribute("height","76px"),t.setAttribute("width","76px"),t.style.margin="auto",t.style.paddingBottom="20px",t.setAttribute("src",this.imageURL),e.appendChild(t)}if(this.content.forEach((e=>{if("string"!=typeof e||/<\/?[a-z][\s\S]*>/i.test(e))if(/<\/?[a-z][\s\S]*>/i.test(e)){let t,o=document.createElement("div"),n=document.createDocumentFragment();for(o.innerHTML=e;t=o.firstChild;)n.appendChild(t);a.appendChild(n)}else a.appendChild(e);else{const t=document.createElement("p");t.innerText=e,a.appendChild(t)}})),this.buttonList.length>0){const e=document.createElement("div");e.classList.add("instantgram-modal-footer"),o.appendChild(e),this.buttonList.forEach((t=>{const o=document.createElement("button");o.classList.add("instantgram-modal-button"),o.innerText=t.text,t.active&&o.classList.add("active"),o.onclick=t?.callback?t.callback:this.close.bind(this),e.appendChild(o)}))}else o.style.paddingBottom="4px;";return e}async open(){this.modal&&await this.close(),this.modal=this.createModal(),document.body.appendChild(this.modal),this.modal.classList.add("instantgram-modal-visible"),setTimeout((()=>{this.modal.classList.add("instantgram-modal-show")}))}async close(){this.modal&&(this.modal.classList.remove("instantgram-modal-show"),await e(100),this.modal.classList.remove("instantgram-modal-visible"),this.modal.parentNode.removeChild(this.modal),this.modal=null)}}async function o(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.text()}const n=async function(e,t,n,a){if(Object.keys(e).length>0){const r=Object.keys(e).find((e=>e.includes("Instance")));if(void 0!==r){const l=e[r];if(void 0!==l){const r=l.return.memoizedProps.fallbackSrc;if(void 0!==r)a(r.length>0&&r);else{let r=null!=n;if(!r){let t=/poster\=\"([\s\S]*)\" preload/gm.exec(e.outerHTML.replace(/(\r\n|\n|\r)/gm,"")),o=null;if(t){let e=document.createElement("textarea");e.innerHTML=t[1],o=e.firstChild.nodeValue}var i=o.split("/").pop().split("#")[0].split("?")[0]}let l=null,d=t.querySelectorAll("header > div > div > div > span > a")[0].href,s=await o(d);if(s){let e;s=s.replace(/(\r\n|\n|\r)/gm,"");let t=/profilePage_([0-9]+)/gm;for(;null!==(e=t.exec(s));)e.index===t.lastIndex&&t.lastIndex++,e.forEach((e=>{l=e}))}let c=null;if(l){let e=await o('https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={"id":'+l+',"first":100}');if(e){let t=JSON.parse(e);for(let e=0;ea||t.bottoma)return 100;if(nt.bottom)return 100;const i=o.height;let r=i;nt.bottom&&(r-=a-t.bottom);const l=r/window.innerHeight*100;return Math.round(l)}const i=e=>new Promise(((t,o)=>{const n=new Image;n.onload=()=>{const{naturalWidth:e,naturalHeight:o}=n;t({width:e,height:o})},n.onerror=()=>{o("There was some problem with the image.")},n.src=e}));function r(e,t){return(e.match(/(?:\w+:)?\/\/[^\/]+([^?#]+)/)||[e,t]).pop()+e.match(/(?:\w+:)?\/\/[^\/]+([^?#]+)([^\?]+)(\?.*)?/).pop()}const l={langs:{"en-US":{"helpers.localize_defaultlang":"[instantgram] set language: ${LANG_DEFAULT} \n For more information about available languages please check http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"Works only on instagram.com","index#program@alert_dontFound":'Did you open any Instagram post? Like for example
',"index#program#blob@alert_cannotDownload":"An error has occurred!

Unfortunately we could not download the video try another one.","index#program#profilePageDownload@str_analyzed_from_to":"Analyzed ${data.size} Posts.","index#program#profilePageDownload@is_private_modal_title":"Profile private","index#program#profilePageDownload@is_private_modal_content":"Sorry but this profile is private and can not be downloaded.
Try another profile.","index#program#profilePageDownload@is_private_modal_btn":"Close","index#program#profilePageDownload@stop_collecting_modal_title":"Download started","index#program#profilePageDownload@stop_collecting_modal_content_1":"You can stop the download by clicking the stop button. If you stop the download, all the images already captured will be downloaded.","index#program#profilePageDownload@stop_collecting_modal_content_2":"If you try to download a lot of pictures at once Instagram may block your IP or your account temporarily.","index#program#profilePageDownload@stop_collecting_modal_btn":"Stop Download","index#program#profilePageDownload@collect_media_modal_title":"Please Wait","index#program#profilePageDownload@collect_media_modal_content":"Now images/videos will being collected","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Collected ${this.resolvedContent} of ${postLinks.size} Posts.","index#program#profilePageDownload@collect_media_modal_btn":"Stop collecting and start the download","index#program#profilePageDownload@collection_complete_modal_title":"Media collection complete","index#program#profilePageDownload@collection_complete_modal_content_1":"Please wait.","index#program#profilePageDownload@collection_complete_modal_content_2":"The download will be now generated.","index#program#profilePageDownload@collection_complete_modal_btn":"Close","index#program#profilePageDownload@cannot_download":"Profile could not be downloaded.","index#program#profilePageDownload@download_progress_at":"Download progress at","index#program#profilePageDownload@compression_progress_at":"Compression progress at","index#program#profilePageDownload@download_failed":"Download failed","modules.modal@isLoading":"Trying to load","modules.update@consoleWarnOutdatedInfo":"[instantgram] is outdated. Please check http://thinkbig-company.github.io/instantgram for available updates.","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] Installed version: ${data.version} | New update: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] is looking for available updates...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] updated your current version.","modules.update@determineIfGetUpdateIsNecessary_@update_available":"There is a new update available","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Get update"},"es-AR":{"helpers.localize_defaultlang":"[instantgram] establecer idioma: ${LANG_DEFAULT} \n Para más información sobre los idiomas disponibles, consulte http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"Sólo funciona en instagram.com","index#program@alert_dontFound":'¿Has abierto algún post de Instagram? Como por ejemplo
',"index#program#blob@alert_cannotDownload":"Se ha producido un error.

Desgraciadamente no hemos podido descargar el vídeo, inténtalo con otro.","index#program#profilePageDownload@str_analyzed_from_to":"Había ${data.size} se analizaron los puestos.","index#program#profilePageDownload@is_private_modal_title":"Profile private","index#program#profilePageDownload@is_private_modal_content":"Sorry but this profile is private and can not be downloaded.
Try another profile.","index#program#profilePageDownload@is_private_modal_btn":"Close","index#program#profilePageDownload@stop_collecting_modal_title":"Descarga iniciada","index#program#profilePageDownload@stop_collecting_modal_content_1":'Puede detener la descarga haciendo clic en el botón "Detener la descarga". Cuando se detenga la descarga, se descargarán todas las imágenes que ya se hayan capturado.',"index#program#profilePageDownload@stop_collecting_modal_content_2":"Si intentas descargar muchas imágenes a la vez, Instagram puede bloquear temporalmente tu IP o tu cuenta.","index#program#profilePageDownload@stop_collecting_modal_btn":"Detener la descarga","index#program#profilePageDownload@collect_media_modal_title":"Espere, por favor","index#program#profilePageDownload@collect_media_modal_content":"Ahora se recogen las imágenes/vídeos","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Un total de ${this.resolvedContent} de ${postLinks.size} Puestos recogidos.","index#program#profilePageDownload@collect_media_modal_btn":"Deja de coleccionar y empieza a descargar","index#program#profilePageDownload@collection_complete_modal_title":"Colección de fotos/vídeos completa","index#program#profilePageDownload@collection_complete_modal_content_1":"Por favor, espere.","index#program#profilePageDownload@collection_complete_modal_content_2":"La descarga se genera ahora.","index#program#profilePageDownload@collection_complete_modal_btn":"Cerrar","index#program#profilePageDownload@cannot_download":"No se ha podido descargar el perfil.","modules.modal@isLoading":"Intentando cargar","modules.update@consoleWarnOutdatedInfo":"[instantgram] es obsoleto. Consulte en http://thinkbig-company.github.io/instantgram las actualizaciones disponibles.","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] Versión instalada: ${data.version} | Nueva actualización: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] está buscando actualizaciones disponibles...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] ha actualizado su versión actual.","modules.update@determineIfGetUpdateIsNecessary_@update_available":"Hay una nueva actualización disponible","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Obtener información"},"de-DE":{"helpers.localize_defaultlang":"Ausgewählte Sprache: ${LANG_DEFAULT} \n Weitere Informationen zu den unterstützten Sprachen findest du auf http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"Funktioniert nur auf instagram.com","index#program@alert_dontFound":'Hast du einen Instagram Post geöffnet? Zum Beispiel
',"index#program#blob@alert_cannotDownload":"Es ist ein fehler aufgetreten!

Wir konnten das Video leider nicht Downloaden versuchen Sie ein anderes.","index#program#profilePageDownload@str_analyzed_from_to":"Es wurden ${data.size} Beiträge analysiert.","index#program#profilePageDownload@is_private_modal_title":"Profil ist Privat","index#program#profilePageDownload@is_private_modal_content":"Sorry, aber dieses Profil ist privat und kann nicht heruntergeladen werden.
Versuchen Sie ein anderes Profil.","index#program#profilePageDownload@is_private_modal_btn":"Schließen","index#program#profilePageDownload@stop_collecting_modal_title":"Download gestarted","index#program#profilePageDownload@stop_collecting_modal_content_1":'Sie können den Download stoppen, indem Sie auf die Schaltfläche "Download stoppen" klicken. Wenn Sie das Herunterladen anhalten, werden alle bereits aufgenommenen Bilder heruntergeladen.',"index#program#profilePageDownload@stop_collecting_modal_content_2":"Wenn Sie versuchen, viele Bilder auf einmal herunterzuladen, kann Instagram Ihre IP oder Ihr Konto vorübergehend sperren.","index#program#profilePageDownload@stop_collecting_modal_btn":"Download stoppen","index#program#profilePageDownload@collect_media_modal_title":"Bitte warten","index#program#profilePageDownload@collect_media_modal_content":"Bilder/Videos werden jetzt gesammelt","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Insgesamt ${this.resolvedContent} von ${postLinks.size} Beiträgen gesammelt.","index#program#profilePageDownload@collect_media_modal_btn":"Stoppen Sie das Sammeln und starten Sie den Download","index#program#profilePageDownload@collection_complete_modal_title":"Bilder/Video-Sammlung komplett","index#program#profilePageDownload@collection_complete_modal_content_1":"Bitte warten.","index#program#profilePageDownload@collection_complete_modal_content_2":"Der Download wird nun erzeugt.","index#program#profilePageDownload@collection_complete_modal_btn":"Schließen","index#program#profilePageDownload@cannot_download":"Profil konnte nicht runtergeladen werden.","index#program#profilePageDownload@download_progress_at":"Download-Fortschritt bei","index#program#profilePageDownload@compression_progress_at":"Komprimierungs-Fortschritt bei","index#program#profilePageDownload@download_failed":"Download fehlgeschlagen","modules.modal@isLoading":"Wird versucht zu laden","modules.update@consoleWarnOutdatedInfo":"[instantgram] ist veraltet. Bitte besuche die Seite http://thinkbig-company.github.io/instantgram für ein Update.","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] Installierte Version: ${data.version} | Neue Version: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] sucht nach neuen verfügbaren Updates...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] wurde aktualisiert.","modules.update@determineIfGetUpdateIsNecessary_@update_available":"Es ist ein neues Update verfügbar","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Update laden"},"pt-BR":{"helpers.localize_defaultlang":"[instantgram] idioma configurado: ${LANG_DEFAULT} \npara mais informações sobre os idiomas suportados, acesse http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"[instantgram] somente funciona no instagram.com","index#program@alert_dontFound":'ops, você está em algum post do instagram? ex:
',"index#program#blob@alert_cannotDownload":"Ocorreu um erro!

Não pudemos baixar o vídeo infelizmente tentar outro.","index#program#profilePageDownload@str_analyzed_from_to":"Analyzed ${data.size} Posts.","index#program#profilePageDownload@is_private_modal_title":"Profile private","index#program#profilePageDownload@is_private_modal_content":"Sorry but this profile is private and can not be downloaded.
Try another profile.","index#program#profilePageDownload@is_private_modal_btn":"Close","index#program#profilePageDownload@stop_collecting_modal_title":"Início do download","index#program#profilePageDownload@stop_collecting_modal_content_1":"Você pode interromper o download clicando no botão de parada. Se você interromper o download, todas as imagens já capturadas serão baixadas.","index#program#profilePageDownload@stop_collecting_modal_content_2":"Se você tentar baixar muitas imagens de uma vez, a Instagram poderá bloquear temporariamente seu IP ou sua conta.","index#program#profilePageDownload@stop_collecting_modal_btn":"Parar Download","index#program#profilePageDownload@collect_media_modal_title":"Por favor, aguarde","index#program#profilePageDownload@collect_media_modal_content":"Agora imagens/videos serão coletados","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Recolhido ${este.resolvedContent} de ${postLinks.size} Correios.","index#program#profilePageDownload@collect_media_modal_btn":"Pare de coletar e inicie o download","index#program#profilePageDownload@collection_complete_modal_title":"Coleção de mídia completa","index#program#profilePageDownload@collection_complete_modal_content_1":"Por favor, aguarde.","index#program#profilePageDownload@collection_complete_modal_content_2":"O download será agora gerado.","index#program#profilePageDownload@collection_complete_modal_btn":"Fechar","index#program#profilePageDownload@cannot_download":"O perfil não pôde ser baixado.","modules.modal@isLoading":"Tentando carregar","modules.update@consoleWarnOutdatedInfo":"[instantgram] está desatualizado. Acesse http://thinkbig-company.github.io/instantgram para atualizar","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] versão local: ${data.version} | nova versão: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] está procurando atualizações...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] informações locais atualizadas","modules.update@determineIfGetUpdateIsNecessary_@update_available":"Há uma nova atualização disponível","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Carga de actualização"}}};let d=navigator.language;-1!==d.indexOf("-")&&(d=d.split("-")[0]),-1!==d.indexOf("_")&&(d=d.split("_")[0]);const s={de:"de-DE",en:"en-US",es:"es-AR",pt:"pt-BR"}[d];function c(e,t=s){try{return l.langs.hasOwnProperty(t)||(t="en-US"),l.langs[t][e]?l.langs[t][e]:""}catch(o){return console.error("[instantgram]LOC error:",o),`ops, an error ocurred in localization system. Enter in https://github.com/ThinkBIG-Company/instantgram/issues/new and open an issue with this code: 'LOC_dont_found_str_neither_default:[${t}->${e}]'\n for more information open the console`}}console.info(c("helpers.localize_defaultlang").replace("${LANG_DEFAULT}",s));const m=c;var p;!function(e){e.Image="IMAGE",e.Video="VIDEO",e[void 0]="UNDEFINED"}(p||(p={}));class g{constructor(){this.modal=new t}getName(){return"MediaScanner"}async execute(e,t){let o=!1;try{let d,s,c=!1,g=!1,u=null,f=p.undefined,h=null,_=null,w=0,y=!1,b=document.querySelector("main");if(e.regexProfilePath.test(e.path))return o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,void t(o,e);if(e.regexStoriesURI.test(e.path)){b=document.getElementById("react-root");let e=b.querySelectorAll("section > div > div > div");for(let t=0;t=1&&e[t].classList.length>1){let o=null!==e[t].querySelector("video"),n=null!==e[t].querySelector("div > div img[src]")||null!==e[t].querySelector("div > div img[srcset]");o&&n?(f=p.Video,u=e[t].querySelector("video")):n&&(f=p.Image,null!==e[t].querySelectorAll("img")[0]&&(u=e[t].querySelectorAll("img")[0]));break}}}if(null==u){if(c=document.querySelectorAll('[role="dialog"]').length>0,c){if(_=document.getElementsByTagName("article"),null!=_)for(w=0;w<_.length&&!(_[w].classList.length>=4);w++);g=null!==document.querySelector("article div > div > div > div > button._6CZji")||null!==document.querySelector("article div > div > div > div > button.POSa_")}else if(e.regexRootPath.test(e.path)){b=document.querySelector("main > section"),s=b.querySelectorAll("div > div > div > article");let e=0;for(e=0;e50){g=null!==s[e].querySelector("button > .coreSpriteLeftChevron")||null!==s[e].querySelector("button > .coreSpriteRightChevron");break}}else g=null!==document.querySelector("main div > div > article div > div > div > div > button._6CZji")||null!==document.querySelector("main div > div > article div > div > div > div > button.POSa_");if(g){let t;s=document.getElementsByTagName("article")[w];let o=0;if(e.regexRootPath.test(e.path)){for(b=document.querySelector("main > section"),s=b.querySelectorAll("div > div > div > article"),o=0;o50);o++);t=Array.from(s[o].querySelectorAll("div > div > div > div > div > div > div > ul:first-child > li")).filter((e=>null!=e.firstChild&&e.classList.length>0))}else t=Array.from(s.querySelectorAll("div > div > div > div > div > div > div > ul:first-child > li")).filter((e=>null!=e.firstChild&&e.classList.length>0));if(null!=t&&t.length>0){let n;u=null,h=null,n=e.regexRootPath.test(e.path)?Array.from(s[o].children[0].children[1].children[0].children[1].children):Array.from(s.children[0].children[0].children[0].children[1].children);for(let e=0;e1&&(d=e),d==n.length-1){y=!0;break}for(let e=0;e6&&4==d?t[1]:n.length>6&&5==d||n.length>6&&6==d?t[2]:n.length>6&&7==d?t[1]:n.length>6&&8==d?t[2]:t[d-1]),null!=u){let e=null!==u.querySelector("video"),t=null!==u.querySelector("img[src]")||null!==u.querySelector("img[srcset]");if(e){f=p.Video,u=u.querySelector("video");break}if(t){f=p.Image,u=null!==u.querySelector("img[srcset]")?u.querySelector("img[srcset]"):u.querySelector("img[src]");break}}}}else{let t;if(c){t=document.getElementsByTagName("article")[w];let e=null!==t.querySelector("video"),o=null!==t.querySelector(".KL4Bh > img[src]")||null!==t.querySelector(".KL4Bh > img[srcset]");e?(f=p.Video,u=t.querySelector("video")):o&&(f=p.Image,u=null!==t.querySelector(".KL4Bh > img[srcset]")?t.querySelector(".KL4Bh > img[srcset]"):t.querySelector(".KL4Bh > img[src]"))}else if(e.regexRootPath.test(e.path)?(b=document.querySelector("main > section"),t=b.querySelectorAll("div > div > div > article")):b&&(t=b.querySelectorAll("div > div > article")),t)for(var l=0;l50){let e=null!==t[l].querySelector("video"),o=null!==t[l].querySelector(".KL4Bh > img[src]")||null!==t[l].querySelector(".KL4Bh > img[srcset]");e?(f=p.Video,u=t[l].querySelector("video")):o&&(f=p.Image,u=null!==t[l].querySelector(".KL4Bh > img[srcset]")?t[l].querySelector(".KL4Bh > img[srcset]"):t[l].querySelector(".KL4Bh > img[src]"))}}}switch(f){case p.Image:let a=await async function(e){if(e.getAttribute("srcset")){let t=[];if(e.getAttribute("srcset").split(",").forEach((e=>{t.push(e.trim().split(" "))})),e.hasAttribute("src")&&e.getAttribute("src").length>0){let o={};o[0]=e.getAttribute("src"),o[1]="undefined",t.unshift(o)}let o,n=0,a="";for(let e=0;en&&(n=o,a=t[e][0])}return a.length>0&&a}return!!(e.hasAttribute("src")&&e.getAttribute("src").length>0)&&e.getAttribute("src")}(u);"string"==typeof a&&(h=a),null!=h&&h.length>10?(o=!0,e.foundImage=!0,e.foundVideo=!1,e.foundByModule=this.getName(),window.open(h),t(o,e)):(o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,t(o,e));break;case p.Video:if(void 0===u.src||0==u.src.length?(u=u.querySelectorAll("source"),h=u[0].src):h=u.src,null!=h&&h.length>10)if(h=h.replace("amp;","&"),-1!==h.indexOf("blob:")){const a=this;o=!0,e.foundImage=!1,e.foundVideo=!0,e.foundByModule=a.getName(),this.modal.heading=[`
[instantgram] v${e.VERSION}
`],this.modal.content=['

Loading

',"

"+m("modules.modal@isLoading")+"

"],this.modal.open(),setTimeout((function(){n(u,s,d,(function(n){if(a.modal.close(),n){let a="https://scontent.cdninstagram.com"+r(n,"unknown");window.open(a),t(o,e)}else a.modal.heading=[`
[instantgram] v${e.VERSION}
`],a.modal.content=[m("index#program#blob@alert_cannotDownload")],a.modal.contentStyle="text-align:center",a.modal.buttonList=[{active:!0,text:m("index#program#blob@alert_cannotDownload")}],a.modal.open(),t(o,e)}))}),500)}else{o=!0,e.foundImage=!1,e.foundVideo=!0,e.foundByModule=this.getName();let n="https://scontent.cdninstagram.com"+r(h,"unknown");window.open(n),t(o,e)}else o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,t(o,e);break;default:o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,t(o,e)}}catch(o){console.error(this.getName()+"()",`[instantgram] ${e.VERSION}`,o),t(!1,e)}}}class u{static add(t,o="default",n=5e3){if(null==document.getElementById("instantgram-alert")){var a=document.createElement("style");a.id="instantgram-alert",a.innerHTML=".instantgram-alert-wrapper{position:fixed;bottom:4rem;left:calc(50% - 225px);width:calc(80vw - 1rem);z-index:2000;max-width:550px}.instantgram-alert{opacity:0;transition:opacity .2s;position:relative;margin-top:20px;padding:15px 29px 15px 15px;animation:fade-in .3s;border-radius:5px}.instantgram-alert.fade-in{opacity:1}.instantgram-alert.fade-out{opacity:0}.instantgram-alert-close{position:absolute;content:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke='white' fill='white' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpath stroke='white' d='M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z'/%3E%3C/svg%3E%0A\");cursor:pointer;right:5px;top:5px}.instantgram-alert-default{background-color:#0095f6;color:#fff}.instantgram-alert-warn{background-color:#f69500;color:#fff}.instantgram-alert-error{background-color:#f65a00;color:#fff}",document.head.appendChild(a)}const i=document.createElement("div");i.classList.add("instantgram-alert","instantgram-alert-"+o);const r=document.createElement("i");r.onclick=()=>u.remove(i),r.classList.add("instantgram-alert-close"),i.appendChild(r);const l=document.createElement("div");l.innerHTML=t,i.appendChild(l),u.wrapper.appendChild(i),u.animateIn(i),e(n).then((()=>u.remove(i)))}static animateIn(e){e.animate([{opacity:"0"},{opacity:"1"}],{duration:300,fill:"forwards"})}static addBaseToPage(){document.querySelectorAll(".instantgram-alert-wrapper").forEach((e=>e.remove()));const e=document.createElement("div");return e.classList.add("instantgram-alert-wrapper"),document.body.appendChild(e),e}static remove(e){e.animate([{opacity:"1"},{opacity:"0"}],{duration:300,fill:"forwards"}).finished.then((()=>{e.remove(),this.wrapper.remove()}))}}u.wrapper=u.addBaseToPage(),"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,t,o){const n=Number(0xffffffffn&t),a=Number(t>>32n);this.setUint32(e+(o?0:4),n,o),this.setUint32(e+(o?4:0),a,o)}});var f=e=>new DataView(new ArrayBuffer(e)),h=e=>new Uint8Array(e.buffer||e),_=e=>Math.min(4294967295,Number(e)),w=e=>Math.min(65535,Number(e));function y(e,t,o){if(void 0===t||t instanceof Uint8Array||(t=x(t)),void 0===o||o instanceof Date||(o=new Date(o)),e instanceof File)return{i:t||x(e.name),o:o||new Date(e.lastModified),A:e.stream()};if(e instanceof Response){const n=e.headers.get("content-disposition"),a=n&&n.match(/;\s*filename\*?=["']?(.*?)["']?$/i),i=a&&a[1]||new URL(e.url).pathname.split("/").pop(),r=i&&decodeURIComponent(i);return{i:t||x(r),o:o||new Date(e.headers.get("Last-Modified")||Date.now()),A:e.body}}if(!t||0===t.length)throw new Error("The file must have a name.");if(void 0===o)o=new Date;else if(isNaN(o))throw new Error("Invalid modification date.");if("string"==typeof e)return{i:t,o,A:x(e)};if(e instanceof Blob)return{i:t,o,A:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{i:t,o,A:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{i:t,o,A:h(e)};if(Symbol.asyncIterator in e)return{i:t,o,A:b(e)};throw new TypeError("Unsupported input format.")}function b(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){let o=0;for(;e.desiredSize>o;){const n=await t.next();if(!n.value){e.close();break}{const t=v(n.value);e.enqueue(t),o+=t.byteLength}}}})}function v(e){return"string"==typeof e?x(e):e instanceof Uint8Array?e:h(e)}function x(e){return(new TextEncoder).encode(String(e))}var I=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBw0DAW0CAAF0AAABYwABCpUBAkkBA38DQCABIQBBACECA0AgAEEBdiAAQQFxQaCG4u1+bHMhACACQQFqIgJBCEcNAAsgAUECdCAANgIAIAFBAWoiAUGAAkcNAAsLSQEBfyABQX9zIQFBgIAEIQJBgIAEIABqIQADQCABQf8BcSACLQAAc0ECdCgCACABQQh2cyEBIAJBAWoiAiAASQ0ACyABQX9zuAs"),(e=>e.charCodeAt(0))))),{t:P,c:D,m:S}=I.exports;P();var A=h(S).subarray(65536);function k(e,t=0){for(const o of function*(e){for(;e.length>65536;)yield e.subarray(0,65536),e=e.subarray(65536);e.length&&(yield e)}(e))A.set(o),t=D(o.length,t);return t}function L(e,t,o=0){const n=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,a=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(o,n,1),t.setUint16(o+2,a,1)}function B(e){const t=f(30);return t.setUint32(0,1347093252),t.setUint32(4,754976768),L(e.o,t,10),t.setUint16(26,e.i.length,1),h(t)}async function*C(e){let{A:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=k(t,0),e.l=BigInt(t.length);else{e.l=0n;const o=t.getReader();for(;;){const{value:t,done:n}=await o.read();if(n)break;e.u=k(t,e.u),e.l+=BigInt(t.length),yield t}}}function U(e,t){const o=f(16+(t?8:0));return o.setUint32(0,1347094280),o.setUint32(4,e.u,1),t?(o.setBigUint64(8,e.l,1),o.setBigUint64(16,e.l,1)):(o.setUint32(8,_(e.l),1),o.setUint32(12,_(e.l),1)),h(o)}function E(e,t,o){const n=f(46);return n.setUint32(0,1347092738),n.setUint32(4,755182848),n.setUint16(8,2048),L(e.o,n,12),n.setUint32(16,e.u,1),n.setUint32(20,_(e.l),1),n.setUint32(24,_(e.l),1),n.setUint16(28,e.i.length,1),n.setUint16(30,o?28:0,1),n.setUint16(40,33204,1),n.setUint32(42,_(t),1),h(n)}function N(e,t){const o=f(28);return o.setUint16(0,1,1),o.setUint16(2,24,1),o.setBigUint64(4,e.l,1),o.setBigUint64(12,e.l,1),o.setBigUint64(20,t,1),h(o)}const z=function(){let e=document.getElementById("instantgram-bulk-downloader-download");e&&e.remove();let t=document.createElement("a");return t.id="instantgram-bulk-downloader-download",document.body.appendChild(t),t.setAttribute("style","display: none"),function(e,o){const n=window.URL.createObjectURL(e);t.href=n,t.download=o,t.click(),window.URL.revokeObjectURL(n)}}(),M=e=>"__typename"in e;async function V(e,t=null){const o=await O(e);return{mediaURL:T(o,t),accountName:$(o),timestamp:R(o),originalResponse:o}}const O=(q=async e=>{const t=await(await fetch(`${e}?__a=1`)).json();return"graphql"in t&&t.graphql?t.graphql.shortcode_media:t.items[0]},(...e)=>{try{return q(...e)}catch(e){throw u.add("Looks like Instagram has figured out you are using a downloader.
The download may not work for the next time"),e}});var q;function $(e){return(M(e)?e.owner:e.user).username}function T(e,t=null){let o;if(M(e))if("GraphImage"===e.__typename)o=[e.display_url];else if("GraphVideo"===e.__typename)o=[e.video_url];else if(-1===t)o=[e.display_url];else if(null===t){o=[];for(const t of Array(e.edge_sidecar_to_children.edges.length).keys())o.push(T(e,t)[0])}else o=T(e.edge_sidecar_to_children.edges[t].node);else{const n=-1===t?0:t;if(e.video_versions)o=[e.video_versions[0].url];else if(e.image_versions2)o=[e.image_versions2.candidates[0].url];else{const t=e.carousel_media.map((e=>(e.video_versions?e.video_versions[0]:e.image_versions2.candidates[0]).url));o=null!=n?[t[n]]:t}}return o}function R(e){return M(e)?e.taken_at_timestamp:0}async function G(e,t,o){let n=[],a=!1,i=[].concat.apply([],e).flatMap((e=>"number"==typeof e?[]:[e])),r=[];for(let t=0;t{const t=+e.fetchResponse.headers.get("Content-Length"),o=(new TextEncoder).encode(e.name).length;a+=t+o+92})),a+=22;const i=(e=>new Response(b(async function*(e){const t=[];let o=0n,n=0n,a=0;for await(const i of e){yield B(i),yield i.i,yield*C(i);const e=i.l>=0xffffffffn||o>=0xffffffffn;yield U(i,e),t.push(E(i,o,e)),t.push(i.i),e&&(t.push(N(i,o)),o+=8n),n++,o+=BigInt(46+i.i.length)+i.l,a||(a=e)}let i=0n;for(const e of t)yield e,i+=BigInt(e.length);if(a||o>=0xffffffffn){const e=f(76);e.setUint32(0,1347094022),e.setBigUint64(4,BigInt(44),1),e.setUint32(12,755182848),e.setBigUint64(24,n,1),e.setBigUint64(32,n,1),e.setBigUint64(40,i,1),e.setBigUint64(48,o,1),e.setUint32(56,1347094023),e.setBigUint64(64,o+i,1),e.setUint32(72,1,1),yield h(e)}const r=f(22);r.setUint32(0,1347093766),r.setUint16(8,w(n),1),r.setUint16(10,w(n),1),r.setUint32(12,_(i),1),r.setUint32(16,_(o),1),yield h(r)}(async function*(e){for await(const t of e)t instanceof File||t instanceof Response?yield y(t):yield y(t.input,t.name,t.lastModified)}(e))),{headers:{"Content-Type":"application/zip","Content-Disposition":"attachment"}}))(e).body.getReader();let r=0;const l=[];for(;;){const{done:e,value:t}=await i.read();if(e){n=!1;break}l.push(t),r+=t.length,o({percent:Number((r/a*100).toFixed()),isFirst:n,isLast:r/a*100==100,type:"compression",error:!1})}const d=new Blob(l);z(d,t?`${t}.zip`:"bulk_download.zip")}(n,t,o),a}function F(e){return e.split("?")[0].split("/").pop()}class H{constructor(){this.modal=new t,this.continueImageLoading=!0,this.resolvedContent=1,this.inProgress=!1,this.downloadIndicator=document.createElement("p"),this.downloadIndicator.id="instantgram-bulk-download-indicator",this.downloadIndicator.setAttribute("style","color:green;")}getName(){return"ProfilePageDownload"}atBottom(){return window.pageYOffset+window.innerHeight+100>document.body.scrollHeight}async collectImageLinks(t){this.showStopCollectingModal();const o=new Set;let n,a;this.continueImageLoading=!0,document.body.scrollTop=0,document.documentElement.scrollTop=0;do{this.collectPostLinks(o),scrollBy(0,window.innerHeight),await e(3/(2e3*t)),this.downloadIndicator.innerText=`${m("index#program#profilePageDownload@str_analyzed_from_to").replace("${data.size}",String(o.size))}`,n=document.querySelectorAll("section > main > div:first-child > div > article > div:nth-child(2) svg").length>0,a=0===document.querySelectorAll("._0mzm-.sqdOP.yWX7d").length}while(this.continueImageLoading&&n&&a||!this.atBottom()&&this.continueImageLoading);return this.collectPostLinks(o),o}showStopCollectingModal(){this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@stop_collecting_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@stop_collecting_modal_content_1"),m("index#program#profilePageDownload@stop_collecting_modal_content_2"),this.downloadIndicator],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{text:m("index#program#profilePageDownload@stop_collecting_modal_btn"),active:!0,callback:()=>{this.continueImageLoading=!1}}],this.modal.open()}collectPostLinks(e){Array.from(document.querySelectorAll("section > main > div:first-child > div > article a")).forEach((t=>{const o="href"in t?t.href:t.firstChild?.href;var n;n=o,new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(n)&&e.add(o)}))}async collectMedia(t){return await e(3e3),this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@collect_media_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@collect_media_modal_content"),this.downloadIndicator],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{active:!0,callback:()=>this.resolvedContent=Number.MAX_VALUE,text:m("index#program#profilePageDownload@collect_media_modal_btn")}],await this.modal.open(),this.downloadIndicator.innerText=m("index#program#profilePageDownload@collect_media_modal_content_download_indicator").replace("${this.resolvedContent}",String(this.resolvedContent)).replace("${postLinks.size}",String(t.size)),this.collectDownloadLinks(t)}async collectDownloadLinks(t){this.resolvedContent=1;const o=[];for(const n of t){const a=await V(n);if(await e(2500),o.push([...a.mediaURL,a.timestamp]),this.resolvedContent+=1,this.downloadIndicator.innerText=m("index#program#profilePageDownload@collect_media_modal_content_download_indicator").replace("${this.resolvedContent}",String(this.resolvedContent)).replace("${postLinks.size}",String(t.size)),this.resolvedContent>=t.size)break}return await this.modal.close(),o}displayEndModal(e,t){this.resolvedContent==Number.MAX_VALUE?this.downloadIndicator.innerText=m("index#program#profilePageDownload@collection_complete_modal_title").replace("${this.resolvedContent}",String(e.length)).replace("${postLinks.size}",String(t)):this.downloadIndicator.innerText="",this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@collection_complete_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@collection_complete_modal_content_1"),m("index#program#profilePageDownload@collection_complete_modal_content_2"),this.downloadIndicator],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{active:!0,callback:()=>{this.cleanUp(),this.modal.close()},text:m("index#program#profilePageDownload@collection_complete_modal_btn")}],this.modal.open()}displayIsPrivateModal(){this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@is_private_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@is_private_modal_content")],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{active:!0,callback:()=>{this.cleanUp(),this.modal.close()},text:m("index#program#profilePageDownload@is_private_modal_btn")}],this.modal.open()}getAccountName(e,t){let o;try{o=e.querySelector(t).innerText}catch{o="no_account_found"}return o}updateProgress(e){e.isFirst&&(this.inProgress=!0);const t=`${m("index#program#profilePageDownload@"+e.type+"_progress_at")} ${e.percent}%`;e.isLast&&(this.inProgress=!1,this.downloadIndicator.innerHTML=t),e.error&&(this.downloadIndicator.setAttribute("style","color:red;"),this.downloadIndicator.innerHTML=m("index#program#profilePageDownload@download_failed")),this.inProgress&&(this.downloadIndicator.innerHTML=t,e.error&&(this.downloadIndicator.setAttribute("style","color:red;"),this.downloadIndicator.innerText=m("index#program#profilePageDownload@download_failed")))}cleanUp(){let e=document.getElementById("instantgram-bulk-downloader");void 0!==e&&null!=e&&e.remove();let t=document.getElementById("instantgram-bulk-downloader-download");void 0!==t&&null!=t&&t.remove()}async execute(e,t){try{this.program=e;let o=document.getElementById("instantgram-bulk-downloader"),n=document.getElementsByClassName("instantgram-modal-overlay");if(o&&n)return;{let e=document.createElement("div");e.id="instantgram-bulk-downloader",document.body.appendChild(e)}if(2==document.querySelector("section > main > div:first-child > div > article > div:nth-child(1)").classList.length)return this.displayIsPrivateModal(),e.foundProfile=!1,e.foundByModule=this.getName(),void t(!1,e);e.foundProfile=!0,e.foundByModule=this.getName();const a=await this.collectImageLinks(parseInt("1",0)%3),i=await this.collectMedia(a);this.displayEndModal(i,a.size);let r=await G(i,this.getAccountName(document.body,"section > main > div:first-child > header > section > div:first-child > h2"),(async e=>{this.updateProgress(e)}));this.cleanUp(),this.modal.close(),0==r?(e.foundProfile=!0,e.foundByModule=this.getName(),t(!0,e)):(e.foundProfile=!1,e.foundByModule=void 0,t(!1,e))}catch(t){console.error(this.getName()+"()",`[instantgram] ${e.VERSION}`,t)}}}const W=function(){const e=/^(<|>|[=!<>]=)?\s*(\d+(?:\.\d+){0,2})([a-z][a-z0-9\-]*)?$/i;function t(t,o){let n=(t+"").match(e);return n?(o?n[1]||"==":"")+'"'+(n[2]+".0.0").match(/\d+(?:\.\d+){0,2}/)[0].replace(/(?:^|\.)(\d+)/g,(function(e,t){return Array(9-t.length).join("0")+t}))+(n[3]||"~")+'"':o?"==0":1}return function(e,...o){e=t(e,null);for(var n,a=1;n=arguments[a++];)if(!new Function("return "+e+t(n,1))())return!1;return!0}}();function Q(e){console.warn(m("modules.update@consoleWarnOutdatedInfo")),console.warn(m("modules.update@consoleWarnOutdatedInfoVersions").replace("${data.version}",e.version).replace("${data.onlineVersion}",e.onlineVersion))}const j=async function(e){(function(e){var t=window.localStorage.getItem("instantgram");if("string"==typeof t){let o=JSON.parse(t);return window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:o.onlineVersion,lastVerification:o.lastVerification,dateExpiration:o.dateExpiration})),W(o.onlineVersion,"> "+o.version)&&Q(o),Date.now()>o.dateExpiration}return!0})(e)&&(console.info(m("modules.update@determineIfGetUpdateIsNecessary_contacting")),await fetch("https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={%22id%22:45423705413,%22first%22:100}").then((function(e){return e.json()})).then((function(o){let n=o.data.user.edge_owner_to_timeline_media.edges[0].node.edge_media_to_caption.edges[0].node.text,a=n.match(/(\*|\d+(\.\d+){0,2}(\.\*)?)+/gm)[0],i=new Date;if(i.setDate(i.getDate()+2),window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:a,lastVerification:Date.now(),dateExpiration:i.valueOf()})),console.info(m("modules.update@determineIfGetUpdateIsNecessary_updated")),W(a,"> "+e)){new t({heading:[`
[instantgram] v${e}
`],content:[`
Es ist ein neues Update verfügbar v${a}
`,"
","
","

Changelog

"+n.split("Changelog ")[1]+"
","
",""+m("modules.update@determineIfGetUpdateIsNecessary_@load_update")+"",""],buttonList:[{active:!0,text:"Ok"}]}).open(),Q(JSON.parse(window.localStorage.getItem("instantgram")))}else console.info(window.localStorage.getItem("instantgram"))})).catch((e=>{console.error("Error:",e)})))};console.clear();const K={VERSION:"10.1.1",hostname:window.location.hostname,path:window.location.pathname,regexHostname:/instagram\.com/,regexRootPath:/^\/+$/,regexProfilePath:/^\/([A-Za-z0-9._]{2,3})+\/$/,regexPostPath:/^\/p\//,regexStoriesURI:/stories\/(.*)+/,foundByModule:null,foundVideo:!1,foundImage:!1,foundProfile:!1};K.regexHostname.test(K.hostname)?((new g).execute(K,(function(e,o){K.foundVideo=o.foundVideo,K.foundImage=o.foundImage,K.foundByModule=o.foundByModule,0==e&&o.regexProfilePath.test(o.path)&&(new H).execute(o,(function(e,o){K.foundImage=o.foundImage,K.foundProfile=o.foundProfile,K.foundVideo=o.foundVideo,K.foundByModule=o.foundByModule,0==e&&K.foundProfile&&new t({heading:[`
[instantgram] v${o.VERSION}
`],content:[m("index#program#profilePageDownload@cannot_download")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),null==K.foundByModule&&0==K.foundVideo&&0==K.foundImage&&new t({heading:[`
[instantgram] v${K.VERSION}
`],content:[m("index#program@alert_dontFound")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),j(K.VERSION)):new t({heading:[`
[instantgram] v${K.VERSION}
`],content:[m("index@alert_onlyWorks")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})(); \ No newline at end of file +(()=>{"use strict";function e(e){return new Promise((function(t){setTimeout(t,e)}))}class t{constructor(e){if(this.modal=null,this.imageURL=e?.imageURL||"",this.heading=e?.heading||[""],this.headingStyle=e?.headingStyle||"",this.content=e?.content||[""],this.contentStyle=e?.contentStyle||"",this.buttonList=e?.buttonList||[],null==document.getElementById("instantgram-modal")){var t=document.createElement("style");t.id="instantgram-modal",t.innerHTML='.instantgram-modal-overlay{display:none!important;opacity:0!important;transition:all ease .1s!important;position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:1000!important;background:rgba(0,0,0,.65)!important;justify-content:center!important;align-items:center!important}.instantgram-modal{transition:width ease-in-out .1s!important;display:inline-block!important;width:400px!important;padding:1.6px!important;z-index:1001!important}.instantgram-modal select{margin-left:.8px!important;border:solid 1px #dbdbdb!important;border-radius:3px!important;color:#262626!important;outline:0!important;padding:3px!important;text-align:center!important}@media (min-width:736px){.instantgram-modal{width:500px!important}}.instantgram-modal-content{position:relative;display:flex;flex-direction:column;width:100%!important;pointer-events:auto!important;background-clip:padding-box!important;outline:0!important}.instantgram-modal-header{color:#fff!important;background-color:#fd1d1d!important;background-image:linear-gradient(45deg,#405de6,#5851db,#833ab4,#c13584,#e1306c,#fd1d1d)!important;border-top-left-radius:12px!important;border-top-right-radius:12px!important;padding:0 16px 0 16px!important}.instantgram-modal-header h5{color:#fff!important;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif!important;font-size:16px!important;margin:revert!important}.instantgram-modal-header h5:nth-child(2){margin-top:-15px!important;margin-bottom:20px!important}.instantgram-modal-body{background:#fff!important;position:relative!important;-webkit-box-flex:1!important;-ms-flex:1 1 auto!important;flex:1 1 auto!important;padding:16px!important}.instantgram-modal-body p{display:block!important;margin:revert!important;margin-block-start:1em!important;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif!important;font-size:16px!important}.instantgram-modal-footer{background-color:#fff!important;border-top:1px solid #dbdbdb!important;border-left:0!important;border-right:0!important;border-bottom-left-radius:12px!important;border-bottom-right-radius:12px!important;line-height:1.5!important;min-height:48px!important;padding:4px 8px!important;user-select:none!important;display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important;-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:center!important}.instantgram-modal-footer button{width:100%!important;min-height:39px!important;background-color:transparent!important;border:0!important;outline:0!important;cursor:pointer!important;font-family:"Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif!important;font-size:16px!important}.instantgram-modal-footer button.active{color:#0095e2!important}.instantgram-modal-show{opacity:1!important}.instantgram-modal-visible{display:flex!important}#instantgram-bulk-download-indicator{text-align:center!important}',document.head.appendChild(t)}}get element(){return this.modal}createModal(){const e=document.createElement("div");e.classList.add("instantgram-modal-overlay");const t=document.createElement("div");t.classList.add("instantgram-modal"),e.appendChild(t);const o=document.createElement("div");o.classList.add("instantgram-modal-content"),t.appendChild(o);const n=document.createElement("div");n.classList.add("instantgram-modal-header"),this.headingStyle.length>0&&n.setAttribute("style",this.headingStyle),o.appendChild(n),this.heading.forEach((e=>{if("string"!=typeof e||/<\/?[a-z][\s\S]*>/i.test(e))if(/<\/?[a-z][\s\S]*>/i.test(e)){let t,o=document.createElement("div"),a=document.createDocumentFragment();for(o.innerHTML=e;t=o.firstChild;)a.appendChild(t);n.appendChild(a)}else n.appendChild(e);else{const t=document.createElement("h5");t.innerHTML=e,n.appendChild(t)}}));const a=document.createElement("div");if(a.classList.add("instantgram-modal-body"),this.contentStyle.length>0&&a.setAttribute("style",this.contentStyle),o.appendChild(a),this.imageURL.length>0){const e=document.createElement("div");o.appendChild(e);const t=document.createElement("img");t.setAttribute("height","76px"),t.setAttribute("width","76px"),t.style.margin="auto",t.style.paddingBottom="20px",t.setAttribute("src",this.imageURL),e.appendChild(t)}if(this.content.forEach((e=>{if("string"!=typeof e||/<\/?[a-z][\s\S]*>/i.test(e))if(/<\/?[a-z][\s\S]*>/i.test(e)){let t,o=document.createElement("div"),n=document.createDocumentFragment();for(o.innerHTML=e;t=o.firstChild;)n.appendChild(t);a.appendChild(n)}else a.appendChild(e);else{const t=document.createElement("p");t.innerText=e,a.appendChild(t)}})),this.buttonList.length>0){const e=document.createElement("div");e.classList.add("instantgram-modal-footer"),o.appendChild(e),this.buttonList.forEach((t=>{const o=document.createElement("button");o.classList.add("instantgram-modal-button"),o.innerText=t.text,t.active&&o.classList.add("active"),o.onclick=t?.callback?t.callback:this.close.bind(this),e.appendChild(o)}))}else o.style.paddingBottom="4px;";return e}async open(){this.modal&&await this.close(),this.modal=this.createModal(),document.body.appendChild(this.modal),this.modal.classList.add("instantgram-modal-visible"),setTimeout((()=>{this.modal.classList.add("instantgram-modal-show")}))}async close(){this.modal&&(this.modal.classList.remove("instantgram-modal-show"),await e(100),this.modal.classList.remove("instantgram-modal-visible"),this.modal.parentNode.removeChild(this.modal),this.modal=null)}}async function o(e){let t=await fetch(e);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.text()}const n=async function(e,t,n,a){let i=null!=n;if(!i){let t=/poster\=\"([\s\S]*)\" preload/gm.exec(e.outerHTML.replace(/(\r\n|\n|\r)/gm,"")),o=null;if(t){let e=document.createElement("textarea");e.innerHTML=t[1],o=e.firstChild.nodeValue}var r=o.split("/").pop().split("#")[0].split("?")[0]}if(null!=t&&t.length>0){let e=null,l=t[0].querySelectorAll("header > div > div > div > div > span > a")[0].href,d=await o(l);if(d){let t;d=d.replace(/(\r\n|\n|\r)/gm,"");let o=/profilePage_([0-9]+)/gm;for(;null!==(t=o.exec(d));)t.index===o.lastIndex&&o.lastIndex++,t.forEach((t=>{e=t}))}let s=null;if(e){let t=await o('https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={"id":'+e+',"first":100}');if(t){let e=JSON.parse(t);for(let t=0;ta||t.bottoma)return 100;if(nt.bottom)return 100;const i=o.height;let r=i;nt.bottom&&(r-=a-t.bottom);const l=r/window.innerHeight*100;return Math.round(l)}const i=e=>new Promise(((t,o)=>{const n=new Image;n.onload=()=>{const{naturalWidth:e,naturalHeight:o}=n;t({width:e,height:o})},n.onerror=()=>{o("There was some problem with the image.")},n.src=e}));function r(e,t){return(e.match(/(?:\w+:)?\/\/[^\/]+([^?#]+)/)||[e,t]).pop()+e.match(/(?:\w+:)?\/\/[^\/]+([^?#]+)([^\?]+)(\?.*)?/).pop()}const l={langs:{"en-US":{"helpers.localize_defaultlang":"[instantgram] set language: ${LANG_DEFAULT} \n For more information about available languages please check http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"Works only on instagram.com","index#program@alert_dontFound":'Did you open any Instagram post? Like for example
',"index#program#blob@alert_cannotDownload":"An error has occurred!

Unfortunately we could not download the video try another one.","index#program#profilePageDownload@str_analyzed_from_to":"Analyzed ${data.size} Posts.","index#program#profilePageDownload@is_private_modal_title":"Profile private","index#program#profilePageDownload@is_private_modal_content":"Sorry but this profile is private and can not be downloaded.
Try another profile.","index#program#profilePageDownload@is_private_modal_btn":"Close","index#program#profilePageDownload@stop_collecting_modal_title":"Download started","index#program#profilePageDownload@stop_collecting_modal_content_1":"You can stop the download by clicking the stop button. If you stop the download, all the images already captured will be downloaded.","index#program#profilePageDownload@stop_collecting_modal_content_2":"If you try to download a lot of pictures at once Instagram may block your IP or your account temporarily.","index#program#profilePageDownload@stop_collecting_modal_btn":"Stop Download","index#program#profilePageDownload@collect_media_modal_title":"Please Wait","index#program#profilePageDownload@collect_media_modal_content":"Now images/videos will being collected","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Collected ${this.resolvedContent} of ${postLinks.size} Posts.","index#program#profilePageDownload@collect_media_modal_btn":"Stop collecting and start the download","index#program#profilePageDownload@collection_complete_modal_title":"Media collection complete","index#program#profilePageDownload@collection_complete_modal_content_1":"Please wait.","index#program#profilePageDownload@collection_complete_modal_content_2":"The download will be now generated.","index#program#profilePageDownload@collection_complete_modal_btn":"Close","index#program#profilePageDownload@cannot_download":"Profile could not be downloaded.","index#program#profilePageDownload@download_progress_at":"Download progress at","index#program#profilePageDownload@compression_progress_at":"Compression progress at","index#program#profilePageDownload@download_failed":"Download failed","modules.modal@isLoading":"Trying to load","modules.update@consoleWarnOutdatedInfo":"[instantgram] is outdated. Please check http://thinkbig-company.github.io/instantgram for available updates.","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] Installed version: ${data.version} | New update: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] is looking for available updates...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] updated your current version.","modules.update@determineIfGetUpdateIsNecessary_@update_available":"There is a new update available","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Get update"},"es-AR":{"helpers.localize_defaultlang":"[instantgram] establecer idioma: ${LANG_DEFAULT} \n Para más información sobre los idiomas disponibles, consulte http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"Sólo funciona en instagram.com","index#program@alert_dontFound":'¿Has abierto algún post de Instagram? Como por ejemplo
',"index#program#blob@alert_cannotDownload":"Se ha producido un error.

Desgraciadamente no hemos podido descargar el vídeo, inténtalo con otro.","index#program#profilePageDownload@str_analyzed_from_to":"Había ${data.size} se analizaron los puestos.","index#program#profilePageDownload@is_private_modal_title":"Profile private","index#program#profilePageDownload@is_private_modal_content":"Sorry but this profile is private and can not be downloaded.
Try another profile.","index#program#profilePageDownload@is_private_modal_btn":"Close","index#program#profilePageDownload@stop_collecting_modal_title":"Descarga iniciada","index#program#profilePageDownload@stop_collecting_modal_content_1":'Puede detener la descarga haciendo clic en el botón "Detener la descarga". Cuando se detenga la descarga, se descargarán todas las imágenes que ya se hayan capturado.',"index#program#profilePageDownload@stop_collecting_modal_content_2":"Si intentas descargar muchas imágenes a la vez, Instagram puede bloquear temporalmente tu IP o tu cuenta.","index#program#profilePageDownload@stop_collecting_modal_btn":"Detener la descarga","index#program#profilePageDownload@collect_media_modal_title":"Espere, por favor","index#program#profilePageDownload@collect_media_modal_content":"Ahora se recogen las imágenes/vídeos","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Un total de ${this.resolvedContent} de ${postLinks.size} Puestos recogidos.","index#program#profilePageDownload@collect_media_modal_btn":"Deja de coleccionar y empieza a descargar","index#program#profilePageDownload@collection_complete_modal_title":"Colección de fotos/vídeos completa","index#program#profilePageDownload@collection_complete_modal_content_1":"Por favor, espere.","index#program#profilePageDownload@collection_complete_modal_content_2":"La descarga se genera ahora.","index#program#profilePageDownload@collection_complete_modal_btn":"Cerrar","index#program#profilePageDownload@cannot_download":"No se ha podido descargar el perfil.","modules.modal@isLoading":"Intentando cargar","modules.update@consoleWarnOutdatedInfo":"[instantgram] es obsoleto. Consulte en http://thinkbig-company.github.io/instantgram las actualizaciones disponibles.","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] Versión instalada: ${data.version} | Nueva actualización: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] está buscando actualizaciones disponibles...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] ha actualizado su versión actual.","modules.update@determineIfGetUpdateIsNecessary_@update_available":"Hay una nueva actualización disponible","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Obtener información"},"de-DE":{"helpers.localize_defaultlang":"Ausgewählte Sprache: ${LANG_DEFAULT} \n Weitere Informationen zu den unterstützten Sprachen findest du auf http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"Funktioniert nur auf instagram.com","index#program@alert_dontFound":'Hast du einen Instagram Post geöffnet? Zum Beispiel
',"index#program#blob@alert_cannotDownload":"Es ist ein fehler aufgetreten!

Wir konnten das Video leider nicht Downloaden versuchen Sie ein anderes.","index#program#profilePageDownload@str_analyzed_from_to":"Es wurden ${data.size} Beiträge analysiert.","index#program#profilePageDownload@is_private_modal_title":"Profil ist Privat","index#program#profilePageDownload@is_private_modal_content":"Sorry, aber dieses Profil ist privat und kann nicht heruntergeladen werden.
Versuchen Sie ein anderes Profil.","index#program#profilePageDownload@is_private_modal_btn":"Schließen","index#program#profilePageDownload@stop_collecting_modal_title":"Download gestarted","index#program#profilePageDownload@stop_collecting_modal_content_1":'Sie können den Download stoppen, indem Sie auf die Schaltfläche "Download stoppen" klicken. Wenn Sie das Herunterladen anhalten, werden alle bereits aufgenommenen Bilder heruntergeladen.',"index#program#profilePageDownload@stop_collecting_modal_content_2":"Wenn Sie versuchen, viele Bilder auf einmal herunterzuladen, kann Instagram Ihre IP oder Ihr Konto vorübergehend sperren.","index#program#profilePageDownload@stop_collecting_modal_btn":"Download stoppen","index#program#profilePageDownload@collect_media_modal_title":"Bitte warten","index#program#profilePageDownload@collect_media_modal_content":"Bilder/Videos werden jetzt gesammelt","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Insgesamt ${this.resolvedContent} von ${postLinks.size} Beiträgen gesammelt.","index#program#profilePageDownload@collect_media_modal_btn":"Stoppen Sie das Sammeln und starten Sie den Download","index#program#profilePageDownload@collection_complete_modal_title":"Bilder/Video-Sammlung komplett","index#program#profilePageDownload@collection_complete_modal_content_1":"Bitte warten.","index#program#profilePageDownload@collection_complete_modal_content_2":"Der Download wird nun erzeugt.","index#program#profilePageDownload@collection_complete_modal_btn":"Schließen","index#program#profilePageDownload@cannot_download":"Profil konnte nicht runtergeladen werden.","index#program#profilePageDownload@download_progress_at":"Download-Fortschritt bei","index#program#profilePageDownload@compression_progress_at":"Komprimierungs-Fortschritt bei","index#program#profilePageDownload@download_failed":"Download fehlgeschlagen","modules.modal@isLoading":"Wird versucht zu laden","modules.update@consoleWarnOutdatedInfo":"[instantgram] ist veraltet. Bitte besuche die Seite http://thinkbig-company.github.io/instantgram für ein Update.","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] Installierte Version: ${data.version} | Neue Version: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] sucht nach neuen verfügbaren Updates...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] wurde aktualisiert.","modules.update@determineIfGetUpdateIsNecessary_@update_available":"Es ist ein neues Update verfügbar","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Update laden"},"pt-BR":{"helpers.localize_defaultlang":"[instantgram] idioma configurado: ${LANG_DEFAULT} \npara mais informações sobre os idiomas suportados, acesse http://thinkbig-company.github.io/instantgram","index@alert_onlyWorks":"[instantgram] somente funciona no instagram.com","index#program@alert_dontFound":'ops, você está em algum post do instagram? ex:
',"index#program#blob@alert_cannotDownload":"Ocorreu um erro!

Não pudemos baixar o vídeo infelizmente tentar outro.","index#program#profilePageDownload@str_analyzed_from_to":"Analyzed ${data.size} Posts.","index#program#profilePageDownload@is_private_modal_title":"Profile private","index#program#profilePageDownload@is_private_modal_content":"Sorry but this profile is private and can not be downloaded.
Try another profile.","index#program#profilePageDownload@is_private_modal_btn":"Close","index#program#profilePageDownload@stop_collecting_modal_title":"Início do download","index#program#profilePageDownload@stop_collecting_modal_content_1":"Você pode interromper o download clicando no botão de parada. Se você interromper o download, todas as imagens já capturadas serão baixadas.","index#program#profilePageDownload@stop_collecting_modal_content_2":"Se você tentar baixar muitas imagens de uma vez, a Instagram poderá bloquear temporariamente seu IP ou sua conta.","index#program#profilePageDownload@stop_collecting_modal_btn":"Parar Download","index#program#profilePageDownload@collect_media_modal_title":"Por favor, aguarde","index#program#profilePageDownload@collect_media_modal_content":"Agora imagens/videos serão coletados","index#program#profilePageDownload@collect_media_modal_content_download_indicator":"Recolhido ${este.resolvedContent} de ${postLinks.size} Correios.","index#program#profilePageDownload@collect_media_modal_btn":"Pare de coletar e inicie o download","index#program#profilePageDownload@collection_complete_modal_title":"Coleção de mídia completa","index#program#profilePageDownload@collection_complete_modal_content_1":"Por favor, aguarde.","index#program#profilePageDownload@collection_complete_modal_content_2":"O download será agora gerado.","index#program#profilePageDownload@collection_complete_modal_btn":"Fechar","index#program#profilePageDownload@cannot_download":"O perfil não pôde ser baixado.","modules.modal@isLoading":"Tentando carregar","modules.update@consoleWarnOutdatedInfo":"[instantgram] está desatualizado. Acesse http://thinkbig-company.github.io/instantgram para atualizar","modules.update@consoleWarnOutdatedInfoVersions":"[instantgram] versão local: ${data.version} | nova versão: ${data.onlineVersion}","modules.update@determineIfGetUpdateIsNecessary_contacting":"[instantgram] está procurando atualizações...","modules.update@determineIfGetUpdateIsNecessary_updated":"[instantgram] informações locais atualizadas","modules.update@determineIfGetUpdateIsNecessary_@update_available":"Há uma nova atualização disponível","modules.update@determineIfGetUpdateIsNecessary_@load_update":"Carga de actualização"}}};let d=navigator.language;-1!==d.indexOf("-")&&(d=d.split("-")[0]),-1!==d.indexOf("_")&&(d=d.split("_")[0]);const s={de:"de-DE",en:"en-US",es:"es-AR",pt:"pt-BR"}[d];function c(e,t=s){try{return l.langs.hasOwnProperty(t)||(t="en-US"),l.langs[t][e]?l.langs[t][e]:""}catch(o){return console.error("[instantgram]LOC error:",o),`ops, an error ocurred in localization system. Enter in https://github.com/ThinkBIG-Company/instantgram/issues/new and open an issue with this code: 'LOC_dont_found_str_neither_default:[${t}->${e}]'\n for more information open the console`}}console.info(c("helpers.localize_defaultlang").replace("${LANG_DEFAULT}",s));const m=c;var p;!function(e){e.Image="IMAGE",e.Video="VIDEO",e[void 0]="UNDEFINED"}(p||(p={}));class g{constructor(){this.modal=new t}getName(){return"MediaScanner"}async execute(e,t){let o=!1;try{let d,s,c=!1,g=!1,u=null,f=p.undefined,h=null,_=null,w=0,y=!1,b=document.querySelector("main");if(e.regexProfilePath.test(e.path))return o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,void t(o,e);if(e.regexStoriesURI.test(e.path)){b=document.getElementById("react-root");let e=b.querySelectorAll("section > div > div > div");for(let t=0;t=1&&e[t].classList.length>1){let o=null!==e[t].querySelector("video"),n=null!==e[t].querySelector("div > div img[src]")||null!==e[t].querySelector("div > div img[srcset]");o&&n?(f=p.Video,u=e[t].querySelector("video")):n&&(f=p.Image,null!==e[t].querySelectorAll("img")[0]&&(u=e[t].querySelectorAll("img")[0]));break}}}if(null==u){if(c=document.querySelectorAll('[role="dialog"]').length>0,c){if(_=document.getElementsByTagName("article"),null!=_)for(w=0;w<_.length&&!(_[w].classList.length>=4);w++);g=null!==document.querySelector("article div > div > div > div > button._6CZji")||null!==document.querySelector("article div > div > div > div > button.POSa_")}else if(e.regexRootPath.test(e.path)){b=document.querySelector("main > section"),s=b.querySelectorAll("div > div > div > article");let e=0;for(e=0;e50){g=null!==s[e].querySelector("button > .coreSpriteLeftChevron")||null!==s[e].querySelector("button > .coreSpriteRightChevron");break}}else g=null!==document.querySelector("main div > div > article div > div > div > div > button._6CZji")||null!==document.querySelector("main div > div > article div > div > div > div > button.POSa_");if(g){let t;s=document.getElementsByTagName("article")[w];let o=0;if(e.regexRootPath.test(e.path)){for(b=document.querySelector("main > section"),s=b.querySelectorAll("div > div > div > article"),o=0;o50);o++);t=Array.from(s[o].querySelectorAll("div > div > div > div > div > div > div > ul:first-child > li")).filter((e=>null!=e.firstChild&&e.classList.length>0))}else t=Array.from(s.querySelectorAll("div > div > div > div > div > div > div > ul:first-child > li")).filter((e=>null!=e.firstChild&&e.classList.length>0));if(null!=t&&t.length>0){let n;u=null,h=null,n=e.regexRootPath.test(e.path)?Array.from(s[o].children[0].children[1].children[0].children[1].children):Array.from(s.children[0].children[0].children[0].children[1].children);for(let e=0;e1&&(d=e),d==n.length-1){y=!0;break}for(let e=0;e6&&4==d?t[1]:n.length>6&&5==d||n.length>6&&6==d?t[2]:n.length>6&&7==d?t[1]:n.length>6&&8==d?t[2]:t[d-1]),null!=u){let e=null!==u.querySelector("video"),t=null!==u.querySelector("img[src]")||null!==u.querySelector("img[srcset]");if(e){f=p.Video,u=u.querySelector("video");break}if(t){f=p.Image,u=null!==u.querySelector("img[srcset]")?u.querySelector("img[srcset]"):u.querySelector("img[src]");break}}}}else if(c){s=document.getElementsByTagName("article")[w];let e=null!==s.querySelector("video"),t=null!==s.querySelector(".KL4Bh > img[src]")||null!==s.querySelector(".KL4Bh > img[srcset]");e?(f=p.Video,u=s.querySelector("video")):t&&(f=p.Image,u=null!==s.querySelector(".KL4Bh > img[srcset]")?s.querySelector(".KL4Bh > img[srcset]"):s.querySelector(".KL4Bh > img[src]"))}else if(e.regexRootPath.test(e.path)?(b=document.querySelector("main > section"),s=b.querySelectorAll("div > div > div > article")):b&&(s=b.querySelectorAll("div > div > article")),s)for(var l=0;l50){let e=null!==s[l].querySelector("video"),t=null!==s[l].querySelector(".KL4Bh > img[src]")||null!==s[l].querySelector(".KL4Bh > img[srcset]");e?(f=p.Video,u=s[l].querySelector("video")):t&&(f=p.Image,u=null!==s[l].querySelector(".KL4Bh > img[srcset]")?s[l].querySelector(".KL4Bh > img[srcset]"):s[l].querySelector(".KL4Bh > img[src]"))}}switch(f){case p.Image:let a=await async function(e){if(e.getAttribute("srcset")){let t=[];if(e.getAttribute("srcset").split(",").forEach((e=>{t.push(e.trim().split(" "))})),e.hasAttribute("src")&&e.getAttribute("src").length>0){let o={};o[0]=e.getAttribute("src"),o[1]="undefined",t.unshift(o)}let o,n=0,a="";for(let e=0;en&&(n=o,a=t[e][0])}return a.length>0&&a}return!!(e.hasAttribute("src")&&e.getAttribute("src").length>0)&&e.getAttribute("src")}(u);"string"==typeof a&&(h=a),null!=h&&h.length>10?(o=!0,e.foundImage=!0,e.foundVideo=!1,e.foundByModule=this.getName(),window.open(h),t(o,e)):(o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,t(o,e));break;case p.Video:if(void 0===u.src||0==u.src.length?(u=u.querySelectorAll("source"),h=u[0].src):h=u.src,null!=h&&h.length>10)if(h=h.replace("amp;","&"),-1!==h.indexOf("blob:")){const a=this;o=!0,e.foundImage=!1,e.foundVideo=!0,e.foundByModule=a.getName(),this.modal.heading=[`
[instantgram] v${e.VERSION}
`],this.modal.content=['

Loading

',"

"+m("modules.modal@isLoading")+"

"],this.modal.open(),setTimeout((function(){n(u,s,d,(function(n){if(a.modal.close(),n){let a="https://scontent.cdninstagram.com"+r(n,"unknown");window.open(a),t(o,e)}else a.modal.heading=[`
[instantgram] v${e.VERSION}
`],a.modal.content=[m("index#program#blob@alert_cannotDownload")],a.modal.contentStyle="text-align:center",a.modal.buttonList=[{active:!0,text:m("index#program#blob@alert_cannotDownload")}],a.modal.open(),t(o,e)}))}),500)}else{o=!0,e.foundImage=!1,e.foundVideo=!0,e.foundByModule=this.getName();let n="https://scontent.cdninstagram.com"+r(h,"unknown");window.open(n),t(o,e)}else o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,t(o,e);break;default:o=!1,e.foundImage=!1,e.foundVideo=!1,e.foundByModule=void 0,t(o,e)}}catch(o){console.error(this.getName()+"()",`[instantgram] ${e.VERSION}`,o),t(!1,e)}}}class u{static add(t,o="default",n=5e3){if(null==document.getElementById("instantgram-alert")){var a=document.createElement("style");a.id="instantgram-alert",a.innerHTML=".instantgram-alert-wrapper{position:fixed;bottom:4rem;left:calc(50% - 225px);width:calc(80vw - 1rem);z-index:2000;max-width:550px}.instantgram-alert{opacity:0;transition:opacity .2s;position:relative;margin-top:20px;padding:15px 29px 15px 15px;animation:fade-in .3s;border-radius:5px}.instantgram-alert.fade-in{opacity:1}.instantgram-alert.fade-out{opacity:0}.instantgram-alert-close{position:absolute;content:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' stroke='white' fill='white' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpath stroke='white' d='M14.53 4.53l-1.06-1.06L9 7.94 4.53 3.47 3.47 4.53 7.94 9l-4.47 4.47 1.06 1.06L9 10.06l4.47 4.47 1.06-1.06L10.06 9z'/%3E%3C/svg%3E%0A\");cursor:pointer;right:5px;top:5px}.instantgram-alert-default{background-color:#0095f6;color:#fff}.instantgram-alert-warn{background-color:#f69500;color:#fff}.instantgram-alert-error{background-color:#f65a00;color:#fff}",document.head.appendChild(a)}const i=document.createElement("div");i.classList.add("instantgram-alert","instantgram-alert-"+o);const r=document.createElement("i");r.onclick=()=>u.remove(i),r.classList.add("instantgram-alert-close"),i.appendChild(r);const l=document.createElement("div");l.innerHTML=t,i.appendChild(l),u.wrapper.appendChild(i),u.animateIn(i),e(n).then((()=>u.remove(i)))}static animateIn(e){e.animate([{opacity:"0"},{opacity:"1"}],{duration:300,fill:"forwards"})}static addBaseToPage(){document.querySelectorAll(".instantgram-alert-wrapper").forEach((e=>e.remove()));const e=document.createElement("div");return e.classList.add("instantgram-alert-wrapper"),document.body.appendChild(e),e}static remove(e){e.animate([{opacity:"1"},{opacity:"0"}],{duration:300,fill:"forwards"}).finished.then((()=>{e.remove(),this.wrapper.remove()}))}}u.wrapper=u.addBaseToPage(),"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}}),"setBigUint64"in DataView.prototype||Object.defineProperty(DataView.prototype,"setBigUint64",{value(e,t,o){const n=Number(0xffffffffn&t),a=Number(t>>32n);this.setUint32(e+(o?0:4),n,o),this.setUint32(e+(o?4:0),a,o)}});var f=e=>new DataView(new ArrayBuffer(e)),h=e=>new Uint8Array(e.buffer||e),_=e=>Math.min(4294967295,Number(e)),w=e=>Math.min(65535,Number(e));function y(e,t,o){if(void 0===t||t instanceof Uint8Array||(t=x(t)),void 0===o||o instanceof Date||(o=new Date(o)),e instanceof File)return{i:t||x(e.name),o:o||new Date(e.lastModified),A:e.stream()};if(e instanceof Response){const n=e.headers.get("content-disposition"),a=n&&n.match(/;\s*filename\*?=["']?(.*?)["']?$/i),i=a&&a[1]||new URL(e.url).pathname.split("/").pop(),r=i&&decodeURIComponent(i);return{i:t||x(r),o:o||new Date(e.headers.get("Last-Modified")||Date.now()),A:e.body}}if(!t||0===t.length)throw new Error("The file must have a name.");if(void 0===o)o=new Date;else if(isNaN(o))throw new Error("Invalid modification date.");if("string"==typeof e)return{i:t,o,A:x(e)};if(e instanceof Blob)return{i:t,o,A:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{i:t,o,A:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{i:t,o,A:h(e)};if(Symbol.asyncIterator in e)return{i:t,o,A:b(e)};throw new TypeError("Unsupported input format.")}function b(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(e){let o=0;for(;e.desiredSize>o;){const n=await t.next();if(!n.value){e.close();break}{const t=v(n.value);e.enqueue(t),o+=t.byteLength}}}})}function v(e){return"string"==typeof e?x(e):e instanceof Uint8Array?e:h(e)}function x(e){return(new TextEncoder).encode(String(e))}var I=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBw0DAW0CAAF0AAABYwABCpUBAkkBA38DQCABIQBBACECA0AgAEEBdiAAQQFxQaCG4u1+bHMhACACQQFqIgJBCEcNAAsgAUECdCAANgIAIAFBAWoiAUGAAkcNAAsLSQEBfyABQX9zIQFBgIAEIQJBgIAEIABqIQADQCABQf8BcSACLQAAc0ECdCgCACABQQh2cyEBIAJBAWoiAiAASQ0ACyABQX9zuAs"),(e=>e.charCodeAt(0))))),{t:P,c:D,m:S}=I.exports;P();var A=h(S).subarray(65536);function k(e,t=0){for(const o of function*(e){for(;e.length>65536;)yield e.subarray(0,65536),e=e.subarray(65536);e.length&&(yield e)}(e))A.set(o),t=D(o.length,t);return t}function L(e,t,o=0){const n=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,a=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(o,n,1),t.setUint16(o+2,a,1)}function B(e){const t=f(30);return t.setUint32(0,1347093252),t.setUint32(4,754976768),L(e.o,t,10),t.setUint16(26,e.i.length,1),h(t)}async function*C(e){let{A:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=k(t,0),e.l=BigInt(t.length);else{e.l=0n;const o=t.getReader();for(;;){const{value:t,done:n}=await o.read();if(n)break;e.u=k(t,e.u),e.l+=BigInt(t.length),yield t}}}function U(e,t){const o=f(16+(t?8:0));return o.setUint32(0,1347094280),o.setUint32(4,e.u,1),t?(o.setBigUint64(8,e.l,1),o.setBigUint64(16,e.l,1)):(o.setUint32(8,_(e.l),1),o.setUint32(12,_(e.l),1)),h(o)}function E(e,t,o){const n=f(46);return n.setUint32(0,1347092738),n.setUint32(4,755182848),n.setUint16(8,2048),L(e.o,n,12),n.setUint32(16,e.u,1),n.setUint32(20,_(e.l),1),n.setUint32(24,_(e.l),1),n.setUint16(28,e.i.length,1),n.setUint16(30,o?28:0,1),n.setUint16(40,33204,1),n.setUint32(42,_(t),1),h(n)}function N(e,t){const o=f(28);return o.setUint16(0,1,1),o.setUint16(2,24,1),o.setBigUint64(4,e.l,1),o.setBigUint64(12,e.l,1),o.setBigUint64(20,t,1),h(o)}const z=function(){let e=document.getElementById("instantgram-bulk-downloader-download");e&&e.remove();let t=document.createElement("a");return t.id="instantgram-bulk-downloader-download",document.body.appendChild(t),t.setAttribute("style","display: none"),function(e,o){const n=window.URL.createObjectURL(e);t.href=n,t.download=o,t.click(),window.URL.revokeObjectURL(n)}}(),M=e=>"__typename"in e;async function V(e,t=null){const o=await q(e);return{mediaURL:T(o,t),accountName:$(o),timestamp:R(o),originalResponse:o}}const q=(O=async e=>{const t=await(await fetch(`${e}?__a=1`)).json();return"graphql"in t&&t.graphql?t.graphql.shortcode_media:t.items[0]},(...e)=>{try{return O(...e)}catch(e){throw u.add("Looks like Instagram has figured out you are using a downloader.
The download may not work for the next time"),e}});var O;function $(e){return(M(e)?e.owner:e.user).username}function T(e,t=null){let o;if(M(e))if("GraphImage"===e.__typename)o=[e.display_url];else if("GraphVideo"===e.__typename)o=[e.video_url];else if(-1===t)o=[e.display_url];else if(null===t){o=[];for(const t of Array(e.edge_sidecar_to_children.edges.length).keys())o.push(T(e,t)[0])}else o=T(e.edge_sidecar_to_children.edges[t].node);else{const n=-1===t?0:t;if(e.video_versions)o=[e.video_versions[0].url];else if(e.image_versions2)o=[e.image_versions2.candidates[0].url];else{const t=e.carousel_media.map((e=>(e.video_versions?e.video_versions[0]:e.image_versions2.candidates[0]).url));o=null!=n?[t[n]]:t}}return o}function R(e){return M(e)?e.taken_at_timestamp:0}async function G(e,t,o){let n=[],a=!1,i=[].concat.apply([],e).flatMap((e=>"number"==typeof e?[]:[e])),r=[];for(let t=0;t{const t=+e.fetchResponse.headers.get("Content-Length"),o=(new TextEncoder).encode(e.name).length;a+=t+o+92})),a+=22;const i=(e=>new Response(b(async function*(e){const t=[];let o=0n,n=0n,a=0;for await(const i of e){yield B(i),yield i.i,yield*C(i);const e=i.l>=0xffffffffn||o>=0xffffffffn;yield U(i,e),t.push(E(i,o,e)),t.push(i.i),e&&(t.push(N(i,o)),o+=8n),n++,o+=BigInt(46+i.i.length)+i.l,a||(a=e)}let i=0n;for(const e of t)yield e,i+=BigInt(e.length);if(a||o>=0xffffffffn){const e=f(76);e.setUint32(0,1347094022),e.setBigUint64(4,BigInt(44),1),e.setUint32(12,755182848),e.setBigUint64(24,n,1),e.setBigUint64(32,n,1),e.setBigUint64(40,i,1),e.setBigUint64(48,o,1),e.setUint32(56,1347094023),e.setBigUint64(64,o+i,1),e.setUint32(72,1,1),yield h(e)}const r=f(22);r.setUint32(0,1347093766),r.setUint16(8,w(n),1),r.setUint16(10,w(n),1),r.setUint32(12,_(i),1),r.setUint32(16,_(o),1),yield h(r)}(async function*(e){for await(const t of e)t instanceof File||t instanceof Response?yield y(t):yield y(t.input,t.name,t.lastModified)}(e))),{headers:{"Content-Type":"application/zip","Content-Disposition":"attachment"}}))(e).body.getReader();let r=0;const l=[];for(;;){const{done:e,value:t}=await i.read();if(e){n=!1;break}l.push(t),r+=t.length,o({percent:Number((r/a*100).toFixed()),isFirst:n,isLast:r/a*100==100,type:"compression",error:!1})}const d=new Blob(l);z(d,t?`${t}.zip`:"bulk_download.zip")}(n,t,o),a}function F(e){return e.split("?")[0].split("/").pop()}class H{constructor(){this.modal=new t,this.continueImageLoading=!0,this.resolvedContent=1,this.inProgress=!1,this.downloadIndicator=document.createElement("p"),this.downloadIndicator.id="instantgram-bulk-download-indicator",this.downloadIndicator.setAttribute("style","color:green;")}getName(){return"ProfilePageDownload"}atBottom(){return window.pageYOffset+window.innerHeight+100>document.body.scrollHeight}async collectImageLinks(t){this.showStopCollectingModal();const o=new Set;let n,a;this.continueImageLoading=!0,document.body.scrollTop=0,document.documentElement.scrollTop=0;do{this.collectPostLinks(o),scrollBy(0,window.innerHeight),await e(3/(2e3*t)),this.downloadIndicator.innerText=`${m("index#program#profilePageDownload@str_analyzed_from_to").replace("${data.size}",String(o.size))}`,n=document.querySelectorAll("section > main > div:first-child > div > article > div:nth-child(2) svg").length>0,a=0===document.querySelectorAll("._0mzm-.sqdOP.yWX7d").length}while(this.continueImageLoading&&n&&a||!this.atBottom()&&this.continueImageLoading);return this.collectPostLinks(o),o}showStopCollectingModal(){this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@stop_collecting_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@stop_collecting_modal_content_1"),m("index#program#profilePageDownload@stop_collecting_modal_content_2"),this.downloadIndicator],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{text:m("index#program#profilePageDownload@stop_collecting_modal_btn"),active:!0,callback:()=>{this.continueImageLoading=!1}}],this.modal.open()}collectPostLinks(e){Array.from(document.querySelectorAll("section > main > div:first-child > div > article a")).forEach((t=>{const o="href"in t?t.href:t.firstChild?.href;var n;n=o,new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(n)&&e.add(o)}))}async collectMedia(t){return await e(3e3),this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@collect_media_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@collect_media_modal_content"),this.downloadIndicator],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{active:!0,callback:()=>this.resolvedContent=Number.MAX_VALUE,text:m("index#program#profilePageDownload@collect_media_modal_btn")}],await this.modal.open(),this.downloadIndicator.innerText=m("index#program#profilePageDownload@collect_media_modal_content_download_indicator").replace("${this.resolvedContent}",String(this.resolvedContent)).replace("${postLinks.size}",String(t.size)),this.collectDownloadLinks(t)}async collectDownloadLinks(t){this.resolvedContent=1;const o=[];for(const n of t){const a=await V(n);if(await e(2500),o.push([...a.mediaURL,a.timestamp]),this.resolvedContent+=1,this.downloadIndicator.innerText=m("index#program#profilePageDownload@collect_media_modal_content_download_indicator").replace("${this.resolvedContent}",String(this.resolvedContent)).replace("${postLinks.size}",String(t.size)),this.resolvedContent>=t.size)break}return await this.modal.close(),o}displayEndModal(e,t){this.resolvedContent==Number.MAX_VALUE?this.downloadIndicator.innerText=m("index#program#profilePageDownload@collection_complete_modal_title").replace("${this.resolvedContent}",String(e.length)).replace("${postLinks.size}",String(t)):this.downloadIndicator.innerText="",this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@collection_complete_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@collection_complete_modal_content_1"),m("index#program#profilePageDownload@collection_complete_modal_content_2"),this.downloadIndicator],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{active:!0,callback:()=>{this.cleanUp(),this.modal.close()},text:m("index#program#profilePageDownload@collection_complete_modal_btn")}],this.modal.open()}displayIsPrivateModal(){this.modal.heading=[`
[instantgram] ${m("index#program#profilePageDownload@is_private_modal_title")}v${this.program.VERSION}
`],this.modal.content=[m("index#program#profilePageDownload@is_private_modal_content")],this.modal.contentStyle="text-align:center",this.modal.buttonList=[{active:!0,callback:()=>{this.cleanUp(),this.modal.close()},text:m("index#program#profilePageDownload@is_private_modal_btn")}],this.modal.open()}getAccountName(e,t){let o;try{o=e.querySelector(t).innerText}catch{o="no_account_found"}return o}updateProgress(e){e.isFirst&&(this.inProgress=!0);const t=`${m("index#program#profilePageDownload@"+e.type+"_progress_at")} ${e.percent}%`;e.isLast&&(this.inProgress=!1,this.downloadIndicator.innerHTML=t),e.error&&(this.downloadIndicator.setAttribute("style","color:red;"),this.downloadIndicator.innerHTML=m("index#program#profilePageDownload@download_failed")),this.inProgress&&(this.downloadIndicator.innerHTML=t,e.error&&(this.downloadIndicator.setAttribute("style","color:red;"),this.downloadIndicator.innerText=m("index#program#profilePageDownload@download_failed")))}cleanUp(){let e=document.getElementById("instantgram-bulk-downloader");void 0!==e&&null!=e&&e.remove();let t=document.getElementById("instantgram-bulk-downloader-download");void 0!==t&&null!=t&&t.remove()}async execute(e,t){try{this.program=e;let o=document.getElementById("instantgram-bulk-downloader"),n=document.getElementsByClassName("instantgram-modal-overlay");if(o&&n)return;{let e=document.createElement("div");e.id="instantgram-bulk-downloader",document.body.appendChild(e)}if(2==document.querySelector("section > main > div:first-child > div > article > div:nth-child(1)").classList.length)return this.displayIsPrivateModal(),e.foundProfile=!1,e.foundByModule=this.getName(),void t(!1,e);e.foundProfile=!0,e.foundByModule=this.getName();const a=await this.collectImageLinks(parseInt("1",0)%3),i=await this.collectMedia(a);this.displayEndModal(i,a.size);let r=await G(i,this.getAccountName(document.body,"section > main > div:first-child > header > section > div:first-child > h2"),(async e=>{this.updateProgress(e)}));this.cleanUp(),this.modal.close(),0==r?(e.foundProfile=!0,e.foundByModule=this.getName(),t(!0,e)):(e.foundProfile=!1,e.foundByModule=void 0,t(!1,e))}catch(t){console.error(this.getName()+"()",`[instantgram] ${e.VERSION}`,t)}}}const W=function(){const e=/^(<|>|[=!<>]=)?\s*(\d+(?:\.\d+){0,2})([a-z][a-z0-9\-]*)?$/i;function t(t,o){let n=(t+"").match(e);return n?(o?n[1]||"==":"")+'"'+(n[2]+".0.0").match(/\d+(?:\.\d+){0,2}/)[0].replace(/(?:^|\.)(\d+)/g,(function(e,t){return Array(9-t.length).join("0")+t}))+(n[3]||"~")+'"':o?"==0":1}return function(e,...o){e=t(e,null);for(var n,a=1;n=arguments[a++];)if(!new Function("return "+e+t(n,1))())return!1;return!0}}();function Q(e){console.warn(m("modules.update@consoleWarnOutdatedInfo")),console.warn(m("modules.update@consoleWarnOutdatedInfoVersions").replace("${data.version}",e.version).replace("${data.onlineVersion}",e.onlineVersion))}const j=async function(e){(function(e){var t=window.localStorage.getItem("instantgram");if("string"==typeof t){let o=JSON.parse(t);return window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:o.onlineVersion,lastVerification:o.lastVerification,dateExpiration:o.dateExpiration})),W(o.onlineVersion,"> "+o.version)&&Q(o),Date.now()>o.dateExpiration}return!0})(e)&&(console.info(m("modules.update@determineIfGetUpdateIsNecessary_contacting")),await fetch("https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={%22id%22:45423705413,%22first%22:100}").then((function(e){return e.json()})).then((function(o){let n=o.data.user.edge_owner_to_timeline_media.edges[0].node.edge_media_to_caption.edges[0].node.text,a=n.match(/(\*|\d+(\.\d+){0,2}(\.\*)?)+/gm)[0],i=new Date;if(i.setDate(i.getDate()+2),window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:a,lastVerification:Date.now(),dateExpiration:i.valueOf()})),console.info(m("modules.update@determineIfGetUpdateIsNecessary_updated")),W(a,"> "+e)){new t({heading:[`
[instantgram] v${e}
`],content:[`
Es ist ein neues Update verfügbar v${a}
`,"
","
","

Changelog

"+n.split("Changelog ")[1]+"
","
",""+m("modules.update@determineIfGetUpdateIsNecessary_@load_update")+"",""],buttonList:[{active:!0,text:"Ok"}]}).open(),Q(JSON.parse(window.localStorage.getItem("instantgram")))}else console.info(window.localStorage.getItem("instantgram"))})).catch((e=>{console.error("Error:",e)})))};console.clear();const K={VERSION:"10.1.2",hostname:window.location.hostname,path:window.location.pathname,regexHostname:/instagram\.com/,regexRootPath:/^\/+$/,regexProfilePath:/^\/([A-Za-z0-9._]{2,3})+\/$/,regexPostPath:/^\/p\//,regexStoriesURI:/stories\/(.*)+/,foundByModule:null,foundVideo:!1,foundImage:!1,foundProfile:!1};K.regexHostname.test(K.hostname)?((new g).execute(K,(function(e,o){K.foundVideo=o.foundVideo,K.foundImage=o.foundImage,K.foundByModule=o.foundByModule,0==e&&o.regexProfilePath.test(o.path)&&(new H).execute(o,(function(e,o){K.foundImage=o.foundImage,K.foundProfile=o.foundProfile,K.foundVideo=o.foundVideo,K.foundByModule=o.foundByModule,0==e&&K.foundProfile&&new t({heading:[`
[instantgram] v${o.VERSION}
`],content:[m("index#program#profilePageDownload@cannot_download")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),null==K.foundByModule&&0==K.foundVideo&&0==K.foundImage&&new t({heading:[`
[instantgram] v${K.VERSION}
`],content:[m("index#program@alert_dontFound")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),j(K.VERSION)):new t({heading:[`
[instantgram] v${K.VERSION}
`],content:[m("index@alert_onlyWorks")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})(); \ No newline at end of file diff --git a/index.html b/index.html index 54d094f..33c4706 100644 --- a/index.html +++ b/index.html @@ -94,7 +94,7 @@

Instantgram

☁️ A bookmarklet for downloading images from Instagram.

- [instantgram 10.1.1]
+ [instantgram 10.1.2]
drag this button to the bookmark bar of your browser. @@ -106,7 +106,7 @@

[instantgram]

- version + version badge

diff --git a/lang/de-de/index.html b/lang/de-de/index.html index 8a6d6aa..63645a0 100644 --- a/lang/de-de/index.html +++ b/lang/de-de/index.html @@ -94,7 +94,7 @@

Instantgram

☁️ Ein Bookmarklet, um Bilder auf Instagram herunterzuladen

- [instantgram 10.1.1]
+ [instantgram 10.1.2]
Ziehe diesen Button in die Favoritenleiste deines Browsers. @@ -106,7 +106,7 @@

[instantgram]

- version + version badge

diff --git a/lang/en-us/index.html b/lang/en-us/index.html index 54d094f..33c4706 100644 --- a/lang/en-us/index.html +++ b/lang/en-us/index.html @@ -94,7 +94,7 @@

Instantgram

☁️ A bookmarklet for downloading images from Instagram.

- [instantgram 10.1.1]
+ [instantgram 10.1.2]
drag this button to the bookmark bar of your browser. @@ -106,7 +106,7 @@

[instantgram]

- version + version badge

diff --git a/lang/es-ar/index.html b/lang/es-ar/index.html index d3d1c6e..0561f20 100644 --- a/lang/es-ar/index.html +++ b/lang/es-ar/index.html @@ -94,7 +94,7 @@

Instantgram

☁️ Un bookmarklet para descargar imágenes de Instagram.

- [instantgram 10.1.1]
+ [instantgram 10.1.2]
Arrastre este botón a la barra de favoritos de su navegador. @@ -106,7 +106,7 @@

[instantgram]

- version + version badge

diff --git a/lang/pt-br/index.html b/lang/pt-br/index.html index 08d7ce2..6c17c0a 100644 --- a/lang/pt-br/index.html +++ b/lang/pt-br/index.html @@ -94,7 +94,7 @@

Instantgram

☁️ Um bookmarklet para download de fotos do Instagram

- [instantgram 10.1.1]
+ [instantgram 10.1.2]
arraste o botão acima para a barra de favoritos do navegador @@ -106,7 +106,7 @@

[instantgram]

- version + version badge

diff --git a/package.json b/package.json index d805bf8..e753c48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "instantgram", - "version": "10.1.1", + "version": "10.1.2", "description": "A bookmarklet for download photos in Instagram", "author": "Matheus Falcão and from 4.0.0 Sascha Heim", "homepage": "https://thinkbig-company.github.io/instantgram/", diff --git a/src/_langs/partials/button.html b/src/_langs/partials/button.html index c7b4e93..02538db 100644 --- a/src/_langs/partials/button.html +++ b/src/_langs/partials/button.html @@ -1 +1 @@ -[instantgram 10.1.1] \ No newline at end of file +[instantgram 10.1.2] \ No newline at end of file diff --git a/src/helpers/getBlobVideoUrl.ts b/src/helpers/getBlobVideoUrl.ts index a0e079f..ca6afe5 100644 --- a/src/helpers/getBlobVideoUrl.ts +++ b/src/helpers/getBlobVideoUrl.ts @@ -2,105 +2,84 @@ import getDataFromUrl from './getDataFromUrl' async function getBlobVideoUrl(el: HTMLVideoElement, article: any, pos: number, callback: any) { - if (Object.keys(el).length > 0) { - const instanceKey = Object.keys(el).find(key => key.includes('Instance')); + /* Will be used only for single video posts */ + let isMultiVideo = (pos != null) ? true : false; + if (!isMultiVideo) { + let posterRegex = /poster\=\"([\s\S]*)\" preload/gm; + let posterRegexMatch = posterRegex.exec(el.outerHTML.replace(/(\r\n|\n|\r)/gm, '')); + let videoPosterUrl = null; + if (posterRegexMatch) { + // HACK + let div = document.createElement('textarea'); + div.innerHTML = posterRegexMatch[1]; + let decoded = div.firstChild.nodeValue; + videoPosterUrl = decoded; + } + var videoPosterFilename = videoPosterUrl.split('/').pop().split('#')[0].split('?')[0]; + } + + if(article != null && article.length > 0) { + /* Step 1 */ + /* Fetch user id from element */ + let userId = null; + let userProfileUrl = (article[0].querySelectorAll('header > div > div > div > div > span > a')[0] as HTMLLinkElement).href; + + let userProfileUrlResponseData = await getDataFromUrl(userProfileUrl); + if (userProfileUrlResponseData) { + userProfileUrlResponseData = userProfileUrlResponseData.replace(/(\r\n|\n|\r)/gm, ''); - if (typeof instanceKey !== 'undefined') { - const reactVideoEl = el[instanceKey]; + let m; + let regex = /profilePage_([0-9]+)/gm; + while ((m = regex.exec(userProfileUrlResponseData)) !== null) { + /* This is necessary to avoid infinite loops with zero-width matches */ + if (m.index === regex.lastIndex) { + regex.lastIndex++; + } - if (typeof reactVideoEl !== 'undefined') { - const videoUrl = reactVideoEl.return.memoizedProps.fallbackSrc; + /* The result can be accessed through the `m`-variable. */ + m.forEach((match) => { + userId = match; + }) + } + } - if (typeof videoUrl !== 'undefined') { - callback(videoUrl.length > 0 ? videoUrl : false); - } else { - /* Will be used only for single video posts */ - let isMultiVideo = (pos != null) ? true : false; - if (!isMultiVideo) { - let posterRegex = /poster\=\"([\s\S]*)\" preload/gm; - let posterRegexMatch = posterRegex.exec(el.outerHTML.replace(/(\r\n|\n|\r)/gm, '')); - let videoPosterUrl = null; - if (posterRegexMatch) { - // HACK - let div = document.createElement('textarea'); - div.innerHTML = posterRegexMatch[1]; - let decoded = div.firstChild.nodeValue; - videoPosterUrl = decoded; - } - var videoPosterFilename = videoPosterUrl.split('/').pop().split('#')[0].split('?')[0]; - } + /* Step 2 */ + /* Fetch the user data until the file name is found */ + let videoUrl = null; + if (userId) { + let userMediaFeedResponseData = await getDataFromUrl('https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={"id":' + userId + ',"first":100}'); + if (userMediaFeedResponseData) { + let json = JSON.parse(userMediaFeedResponseData); - /* Step 1 */ - /* Fetch user id from element */ - let userId = null; - let userProfileUrl = (article.querySelectorAll('header > div > div > div > span > a')[0] as HTMLLinkElement).href; - let userProfileUrlResponseData = await getDataFromUrl(userProfileUrl); + for (let _fI = 0; _fI < json.data.user.edge_owner_to_timeline_media.edges.length; _fI++) { + if (!isMultiVideo) { + if (json.data.user.edge_owner_to_timeline_media.edges[_fI].node.__typename == 'GraphVideo') { + let GraphVideoNode = json.data.user.edge_owner_to_timeline_media.edges[_fI].node; + if (videoPosterFilename == GraphVideoNode.display_url.split('/').pop().split('#')[0].split('?')[0]) { + videoUrl = GraphVideoNode.video_url; - if (userProfileUrlResponseData) { - userProfileUrlResponseData = userProfileUrlResponseData.replace(/(\r\n|\n|\r)/gm, ''); + /* There exists only one node so break it no need to further analyze */ + break; + } + } + /* Multi Post which can have a video */ + } else { + if (json.data.user.edge_owner_to_timeline_media.edges[_fI].node.__typename == 'GraphSidecar') { + if (json.data.user.edge_owner_to_timeline_media.edges[_fI].node.hasOwnProperty('edge_sidecar_to_children')) { + let GraphSidecarNode = json.data.user.edge_owner_to_timeline_media.edges[_fI].node.edge_sidecar_to_children.edges[pos].node; + videoUrl = GraphSidecarNode.video_url; - let m; - let regex = /profilePage_([0-9]+)/gm; - while ((m = regex.exec(userProfileUrlResponseData)) !== null) { - // This is necessary to avoid infinite loops with zero-width matches - if (m.index === regex.lastIndex) { - regex.lastIndex++; - } - - // The result can be accessed through the `m`-variable. - m.forEach((match) => { - userId = match; - }) - } - } - - /* Step 2 */ - /* Fetch the user data until the file name is found */ - let videoUrl = null; - if (userId) { - let userMediaFeedResponseData = await getDataFromUrl('https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={"id":' + userId + ',"first":100}'); - if (userMediaFeedResponseData) { - let json = JSON.parse(userMediaFeedResponseData); - - for (let _fI = 0; _fI < json.data.user.edge_owner_to_timeline_media.edges.length; _fI++) { - // Handle different instagram post types - // Single Video - if (!isMultiVideo) { - if (json.data.user.edge_owner_to_timeline_media.edges[_fI].node.__typename == 'GraphVideo') { - let GraphVideoNode = json.data.user.edge_owner_to_timeline_media.edges[_fI].node; - if (videoPosterFilename == GraphVideoNode.display_url.split('/').pop().split('#')[0].split('?')[0]) { - videoUrl = GraphVideoNode.video_url; - - // There exists only one node so break it no need to further analyze - break; - } - } - // Multi Post which can have a video - } else { - if (json.data.user.edge_owner_to_timeline_media.edges[_fI].node.__typename == 'GraphSidecar') { - if (json.data.user.edge_owner_to_timeline_media.edges[_fI].node.hasOwnProperty('edge_sidecar_to_children')) { - let GraphSidecarNode = json.data.user.edge_owner_to_timeline_media.edges[_fI].node.edge_sidecar_to_children.edges[pos].node; - videoUrl = GraphSidecarNode.video_url; - - break; - } - } - } - } - } - } - - callback(videoUrl ? videoUrl : false); - } - } else { - callback(false); - } - } else { - callback(false); - } - } else { - callback(false); - } + break; + } + } + } + } + } + } + + callback(videoUrl ? videoUrl : false); + } else { + callback(false); + } } - export default getBlobVideoUrl; \ No newline at end of file diff --git a/src/modules/MediaScanner.ts b/src/modules/MediaScanner.ts index 29fd070..c2fd23d 100644 --- a/src/modules/MediaScanner.ts +++ b/src/modules/MediaScanner.ts @@ -258,11 +258,9 @@ export class MediaScanner implements Module { } } /* - * For single image + * For single image/video */ } else { - let $article: Element | NodeListOf; - if (isModal) { $article = document.getElementsByTagName('article')[predictNeededElementIndex]; @@ -296,13 +294,13 @@ export class MediaScanner implements Module { $article = $container.querySelectorAll('div > div > article'); } } - + if ($article) { for (var i = 0; i < ($article as NodeListOf).length; i++) { if (getElementPercentage($article[i]) > 50) { let isVideo = $article[i].querySelector('video') !== null; let isImage = $article[i].querySelector('.KL4Bh > img[src]') !== null || $article[i].querySelector('.KL4Bh > img[srcset]') !== null; - + if (isVideo) { // Set media type mediaType = MediaType.Video; @@ -326,7 +324,7 @@ export class MediaScanner implements Module { } } } - + if (process.env.DEV) { console.log(['mediaType', mediaType]); }