n&&(n=o,a=t[e][0])}return a.length>0&&a}return!!(e.hasAttribute("src")&&e.getAttribute("src").length>0)&&e.getAttribute("src")}(g.mediaEl);"string"==typeof c&&(h=c),null!=h&&h.length>10?(s=!0,t.foundImage=!0,t.foundVideo=!1,i(s,h,t)):(s=!1,t.foundImage=!1,t.foundVideo=!1,i(s,null,t));break;case e.Video:if(void 0===g.mediaEl.src||0==g.mediaEl.src.length?(g.mediaEl=g.mediaEl.querySelectorAll("source"),h=g.mediaEl[0].src):h=g.mediaEl.src,null!=h&&h.length>10){let e=this;l(g.mediaEl,(function(o){let n;s=!0,t.foundImage=!1,t.foundVideo=!0,n="string"==typeof o||o instanceof String?o:o[0].baseUrl&&o[0].baseUrl.length>80?o[0].baseUrl:null,n="https://scontent.cdninstagram.com"+r(n,"unknown"),n?i(s,n,t):(e.modal.heading=[`[instantgram] v${t.VERSION}
`],e.modal.content=[p("index#program#blob@alert_cannotDownload")],e.modal.contentStyle="text-align:center",e.modal.buttonList=[{active:!0,text:"Ok"}],e.modal.open(),i(s,null,t))}))}else s=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(s,null,t);break;default:s=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(s,null,t)}}catch(e){console.error(this.getName()+"()",`[instantgram] ${t.VERSION}`,e),i(!1,null,t)}}}const u=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 f(e){console.warn(p("modules.update@consoleWarnOutdatedInfo")),console.warn(p("modules.update@consoleWarnOutdatedInfoVersions").replace("${data.version}",e.version).replace("${data.onlineVersion}",e.onlineVersion))}const w=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})),u(o.onlineVersion,"> "+o.version)&&f(o),Date.now()>o.dateExpiration}return!0})(e)&&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(t){let o=t.data.user.edge_owner_to_timeline_media.edges[0].node.edge_media_to_caption.edges[0].node.text,n=o.match(/(\*|\d+(\.\d+){0,2}(\.\*)?)+/gm)[0],a=new Date;if(a.setTime(a.getTime()+216e5),window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:n,lastVerification:Date.now(),dateExpiration:a.valueOf()})),console.info(p("modules.update@determineIfGetUpdateIsNecessary_updated")),u(n,"> "+e)){new i({heading:[`[instantgram] v${e}
`],content:[`Es ist ein neues Update verfügbar v${n}
`,"
","
","Changelog
"+o.split("Changelog ")[1]+"","
",""+p("modules.update@determineIfGetUpdateIsNecessary_@load_update")+"",""],buttonList:[{active:!0,text:"Ok"}]}).open(),f(JSON.parse(window.localStorage.getItem("instantgram")))}else console.info(window.localStorage.getItem("instantgram"))})).catch((e=>{console.error("Error:",e)}))};var b=function(e,t,o){if(o||2===arguments.length)for(var n,a=0,i=t.length;a[instantgram] ProfilePage downloader v${O.VERSION}`],content:[p("index@profilepage_downloader_disabled")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()),e&&null!==t&&window.open(t),null==O.foundByModule&&0==O.foundVideo&&0==O.foundImage&&new i({heading:[`[instantgram] v${O.VERSION}
`],content:[p("index#program@alert_dontFound")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),w(O.VERSION)):new i({heading:[`[instantgram] v${O.VERSION}
`],content:[p("index@alert_onlyWorks")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})();
\ No newline at end of file
+(()=>{"use strict";var e;function t(e){let t;t=null!==window&&void 0!==window?{top:window.pageYOffset,bottom:window.pageYOffset+window.innerHeight}:document.documentElement;const o=e.getBoundingClientRect(),n=o.y+window.pageYOffset,a=o.y+o.height+window.pageYOffset;if(t.top>a||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)}!function(e){e.Image="IMAGE",e.Video="VIDEO",e.UNDEFINED="UNDEFINED"}(e||(e={}));class o{getName(){return"FeedScanner"}async execute(o,n){let a=!1;try{let i,r,l,d,s=null,c=e.UNDEFINED,m=!1,g="._aagv",p="._9zm0",u="._9zm2";if(null==s){d=document.getElementsByTagName("article");let e=[];for(let o=0;o :nth-child(2) > :first-child ul > li:nth-child(2) img[crossorigin='anonymous']")||d[o].querySelector(":first-child > :nth-child(2) > :first-child ul > li:nth-child(2) video[crossorigin='anonymous']"):d[o].querySelector(":first-child > :nth-child(2) > [role=button] img[crossorigin='anonymous']")||d[o].querySelector(":first-child > :nth-child(2) video[crossorigin='anonymous']"),null!=n&&null!=typeof n.getBoundingClientRect()){let i=t(n);e.push({i1:o,mediaEl:n,elemVisiblePercentage:i,isCarousel:a})}else e.push({i1:o,mediaEl:n,elemVisiblePercentage:0,isCarousel:a})}let o=e.reduce(((e,t)=>e.elemVisiblePercentage>t.elemVisiblePercentage?e:t));l=d[o.i1],i=e[o.i1]}if(i.isCarousel){let t=Array.from(l.querySelectorAll("div > :first-child > :first-child > :first-child > ul li")).filter((e=>null!=e.firstChild&&e.classList.length>0));if(null!=t&&t.length>0){let n=Array.from(l.querySelectorAll(":first-child > div:nth-child(2) > div > div:nth-child(2) > div")).filter((e=>e.classList.length<=2));for(let e=0;e img[src]`)||null!==l.querySelector(`${g} > img[srcset]`);t?(c=e.Video,s=l.querySelector("video")):o&&(c=e.Image,s=null!==l.querySelector(`${g} > img[srcset]`)?l.querySelector(`${g} > img[srcset]`):l.querySelector(`${g} > img[src]`))}(c==e.Image||c==e.Video&&s)&&(a=!0),n(a,s,c,o)}catch(e){console.error(this.getName()+"()",`[instantgram] ${o.VERSION}`,e),n(!1,null,o)}}}class n{getName(){return"PostScanner"}async execute(t,o,n){let a=!1;try{let i,r,l=o,d=!1,s=null,c=e.UNDEFINED,m=!1,g=document.querySelector("main"),p="._aagv",u="._9zm0",h="._9zm2";if(l?(r=document.querySelectorAll('[role="dialog"]')[1],d=0!==r.querySelectorAll(u).length||0!==r.querySelectorAll(h).length):(g=document.querySelector("section main > div > :first-child"),r=g.querySelector("article"),d=0!==r.querySelectorAll(u).length||0!==r.querySelectorAll(h).length),d){let o=Array.from(r.querySelectorAll("div > :first-child > :first-child > :first-child > ul li")).filter((e=>null!=e.firstChild&&e.classList.length>0));if(null!=o&&o.length>0){let n=Array.from(r.querySelectorAll("article > :first-child > :first-child > :first-child > div:nth-child(2) > div")).filter((e=>e.classList.length<=2));for(let e=0;e img[src]`)||null!==r.querySelector(`${p} > img[srcset]`);t?(c=e.Video,s=r.querySelector("video")):o&&(c=e.Image,s=null!==r.querySelector(`${p} > img[srcset]`)?r.querySelector(`${p} > img[srcset]`):r.querySelector(`${p} > img[src]`))}(c==e.Image||c==e.Video&&s)&&(a=!0),n(a,s,c,t)}catch(e){console.error(this.getName()+"()",`[instantgram] ${t.VERSION}`,e),n(!1,null,t)}}}class a{getName(){return"StoryScanner"}async execute(t,o){let n=!1;try{let a=null,i=e.UNDEFINED,r=document.querySelector("main");r=document.querySelector("body > div:nth-child(2)");let l=r.querySelectorAll("section > div > div > div");for(let t=0;t=1&&l[t].classList.length>1){let o=null!==l[t].querySelector("video"),n=null!==l[t].querySelector("div > div img[src]")||null!==l[t].querySelector("div > div img[srcset]");0,o?(i=e.Video,a=l[t].querySelector("video")):n&&(i=e.Image,null!==l[t].querySelectorAll("img")[0]&&(a=l[t].querySelectorAll("img")[0]));break}}(i==e.Image||i==e.Video&&a)&&(n=!0),o(n,a,i,t)}catch(e){console.error(this.getName()+"()",`[instantgram] ${t.VERSION}`,e),o(!1,null,t)}}}class i{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(){var e;this.modal&&(this.modal.classList.remove("instantgram-modal-show"),await(e=100,new Promise((function(t){setTimeout(t,e)}))),this.modal.classList.remove("instantgram-modal-visible"),this.modal.parentNode.removeChild(this.modal),this.modal=null)}}function r(e,t){return(e.match(/(?:\w+:)?\/\/[^\/]+([^?#]+)/)||[e,t]).pop()+e.match(/(?:\w+:)?\/\/[^\/]+([^?#]+)([^\?]+)(\?.*)?/).pop()}const l=async function(e,t){if(e.src&&!e.src.startsWith("blob:"))return t(e.src),!1;var o=e.closest("section");const n=o[Object.keys(o).find((e=>e.includes("Instance")||e.includes("Fiber")))];if(n&&n.return&&n.return.return&&n.return.return.return&&n.return.return.return.memoizedProps&&n.return.return.return.memoizedProps.post&&n.return.return.return.memoizedProps.post.videoUrl)t(n.return.return.return.memoizedProps.post.videoUrl);else{const o=e[Object.keys(e).find((e=>e.includes("Instance")||e.includes("Fiber")))];if(o.return.return.memoizedProps.manifest){var a,i=(new DOMParser).parseFromString(o.return.return.memoizedProps.manifest,"text/xml"),l=Array.from(i.querySelectorAll('Representation[mimeType="video/mp4"][FBQualityClass="hd"]')).map((function(e){var t,o;return{quality:e.getAttribute("FBQualityClass"),bandwidth:parseInt(e.getAttribute("bandwidth")),baseUrl:null===(o=null===(t=e.querySelector("BaseURL"))||void 0===t?void 0:t.textContent)||void 0===o?void 0:o.trim()}})).filter((function(e){return e.baseUrl}));t(l.sort((function(e,t){return"hd"===e.quality&&"hd"!==t.quality?-1:"hd"!==e.quality&&"hd"===t.quality?1:t.bandwidth-e.bandwidth})),null===(a=l[0])||void 0===a?void 0:a.baseUrl)}else{let e,n;if(o.return.return.memoizedProps.hdSrc?(e=o.return.return.memoizedProps.hdSrc,n="hd"):o.return.return.memoizedProps.sdSrc?(e=o.return.return.memoizedProps.sdSrc,n="sd"):o.return.return.memoizedProps.children[0].props.fallbackSrc?(e=o.return.return.memoizedProps.children[0].props.fallbackSrc,n="fallback"):(e=null,n=null),e.length>80)if("fallback"==n){t("https://scontent.cdninstagram.com"+r(o.return.return.memoizedProps.children[0].props.fallbackSrc,"unknown"))}else t(e);else t(null)}}return!1};const d=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})),s={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@profilepage_downloader_disabled":"Sorry the ProfilePage downloader is currently disabled because instagram changed their system.\n\nMaybe in the future there will be a solution to fix the problem.","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@profilepage_downloader_disabled":"Lo siento, la descarga de ProfilePage está deshabilitada actualmente porque Instagram cambió su sistema.\n\nTal vez en el futuro haya una solución para solucionar el problema.","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@profilepage_downloader_disabled":"Leider ist der ProfilePage-Downloader derzeit deaktiviert, da Instagram sein System geändert hat.\n\nVielleicht gibt es in Zukunft eine Lösung für dieses Problem.","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@profilepage_downloader_disabled":"Lamentamos que o programa de download ProfilePage esteja atualmente desativado porque o programa mudou seu sistema.\n\nTalvez, no futuro, haja uma solução para resolver o problema.","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 c=navigator.language;-1!==c.indexOf("-")&&(c=c.split("-")[0]),-1!==c.indexOf("_")&&(c=c.split("_")[0]);const m={de:"de-DE",en:"en-US",es:"es-AR",pt:"pt-BR"}[c];function g(e,t=m){try{return s.langs.hasOwnProperty(t)||(t="en-US"),s.langs[t][e]?s.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(g("helpers.localize_defaultlang").replace("${LANG_DEFAULT}",m));const p=g;class u{constructor(){this.modal=new i}getName(){return"MediaScanner"}async execute(t,i){let s=!1;try{let m=!1,g={mediaEl:void 0,mediaType:e.UNDEFINED},u=null;if(t.regexProfilePath.test(t.path))return s=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,void i(s,null,t);switch(t.regexStoriesURI.test(t.path)&&(new a).execute(t,(function(e,o,n,i){g.mediaEl=o,g.mediaType=n,e&&(t.foundByModule=(new a).getName())})),null==g.mediaEl&&(m=document.querySelectorAll('[role="dialog"]').length>0,t.regexRootPath.test(t.path)&&(new o).execute(t,(function(e,n,a,i){g.mediaEl=n,g.mediaType=a,e&&(t.foundByModule=(new o).getName())})),t.regexPostPath.test(t.path)&&(new n).execute(t,m,(function(e,o,a,i){g.mediaEl=o,g.mediaType=a,e&&(t.foundByModule=(new n).getName())}))),g.mediaType){case e.Image:var c=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")}(g.mediaEl);"string"==typeof c&&(u=c),null!=u&&u.length>10?(s=!0,t.foundImage=!0,t.foundVideo=!1,i(s,u,t)):(s=!1,t.foundImage=!1,t.foundVideo=!1,i(s,null,t));break;case e.Video:if(void 0===g.mediaEl.src||0==g.mediaEl.src.length?(g.mediaEl=g.mediaEl.querySelectorAll("source"),u=g.mediaEl[0].src):u=g.mediaEl.src,null!=u&&u.length>10){let e=this;l(g.mediaEl,(function(o){let n;s=!0,t.foundImage=!1,t.foundVideo=!0,n="string"==typeof o||o instanceof String?o:o[0].baseUrl&&o[0].baseUrl.length>80?o[0].baseUrl:null,n="https://scontent.cdninstagram.com"+r(n,"unknown"),n?i(s,n,t):(e.modal.heading=[`[instantgram] v${t.VERSION}
`],e.modal.content=[p("index#program#blob@alert_cannotDownload")],e.modal.contentStyle="text-align:center",e.modal.buttonList=[{active:!0,text:"Ok"}],e.modal.open(),i(s,null,t))}))}else s=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(s,null,t);break;default:s=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(s,null,t)}}catch(e){console.error(this.getName()+"()",`[instantgram] ${t.VERSION}`,e),i(!1,null,t)}}}const h=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 f(e){console.warn(p("modules.update@consoleWarnOutdatedInfo")),console.warn(p("modules.update@consoleWarnOutdatedInfoVersions").replace("${data.version}",e.version).replace("${data.onlineVersion}",e.onlineVersion))}const w=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})),h(o.onlineVersion,"> "+o.version)&&f(o),Date.now()>o.dateExpiration}return!0})(e)&&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(t){let o=t.data.user.edge_owner_to_timeline_media.edges[0].node.edge_media_to_caption.edges[0].node.text,n=o.match(/(\*|\d+(\.\d+){0,2}(\.\*)?)+/gm)[0],a=new Date;if(a.setTime(a.getTime()+216e5),window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:n,lastVerification:Date.now(),dateExpiration:a.valueOf()})),console.info(p("modules.update@determineIfGetUpdateIsNecessary_updated")),h(n,"> "+e)){new i({heading:[`[instantgram] v${e}
`],content:[`Es ist ein neues Update verfügbar v${n}
`,"
","
","Changelog
"+o.split("Changelog ")[1]+"","
",""+p("modules.update@determineIfGetUpdateIsNecessary_@load_update")+"",""],buttonList:[{active:!0,text:"Ok"}]}).open(),f(JSON.parse(window.localStorage.getItem("instantgram")))}else console.info(window.localStorage.getItem("instantgram"))})).catch((e=>{console.error("Error:",e)}))};var b=function(e,t,o){if(o||2===arguments.length)for(var n,a=0,i=t.length;a[instantgram] ProfilePage downloader v${z.VERSION}`],content:[p("index@profilepage_downloader_disabled")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()),e&&null!==t&&window.open(t),null==z.foundByModule&&0==z.foundVideo&&0==z.foundImage&&new i({heading:[`[instantgram] v${z.VERSION}
`],content:[p("index#program@alert_dontFound")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),w(z.VERSION)):new i({heading:[`[instantgram] v${z.VERSION}
`],content:[p("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 dc1abe1..19044c7 100644
--- a/index.html
+++ b/index.html
@@ -94,7 +94,7 @@
Instantgram
☁️ A bookmarklet for downloading images from Instagram.
- [instantgram 2022.12.10]
+ [instantgram 2023.04.12]
drag this button to the bookmark bar of your browser.
@@ -106,7 +106,7 @@
-
+
diff --git a/lang/de-de/index.html b/lang/de-de/index.html
index df1e46f..82c4feb 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 2022.12.10]
+ [instantgram 2023.04.12]
Ziehe diesen Button in die Favoritenleiste deines Browsers.
@@ -106,7 +106,7 @@
-
+
diff --git a/lang/en-us/index.html b/lang/en-us/index.html
index dc1abe1..19044c7 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 2022.12.10]
+ [instantgram 2023.04.12]
drag this button to the bookmark bar of your browser.
@@ -106,7 +106,7 @@
-
+
diff --git a/lang/es-ar/index.html b/lang/es-ar/index.html
index 9e6c7c0..cf4b6a3 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 2022.12.10]
+ [instantgram 2023.04.12]
Arrastre este botón a la barra de favoritos de su navegador.
@@ -106,7 +106,7 @@
-
+
diff --git a/lang/pt-br/index.html b/lang/pt-br/index.html
index 110afdd..0589396 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 2022.12.10]
+ [instantgram 2023.04.12]
arraste o botão acima para a barra de favoritos do navegador
@@ -106,7 +106,7 @@
-
+
diff --git a/package.json b/package.json
index 9130453..55baeb3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "instantgram",
- "version": "2022.12.10",
+ "version": "2023.04.12",
"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/",
@@ -55,7 +55,7 @@
"tslib": "^2.4.0",
"typescript": "^4.7.4",
"webextension-polyfill-ts": "^0.25.0",
- "webpack": "^5.74.0",
+ "webpack": "^5.77.0",
"webpack-cli": "^4.10.0"
},
"dependencies": {
diff --git a/src/_langs/partials/button.html b/src/_langs/partials/button.html
index d2c4ba8..01714b5 100644
--- a/src/_langs/partials/button.html
+++ b/src/_langs/partials/button.html
@@ -1 +1 @@
-[instantgram 2022.12.10]
\ No newline at end of file
+[instantgram 2023.04.12]
\ No newline at end of file
diff --git a/src/helpers/bulkDownloader.ts b/src/helpers/bulkDownloader.ts
deleted file mode 100644
index b930891..0000000
--- a/src/helpers/bulkDownloader.ts
+++ /dev/null
@@ -1,252 +0,0 @@
-import { Alert } from '../components/Alert';
-import { ContentResponse } from '../model/extension';
-import { GraphqlQuery, PostItem, PostQuery, ShortcodeMedia } from '../model/post';
-import { downloadZip } from 'client-zip';
-import saveData from './saveData';
-
-const isShortcodeMedia = (media: ShortcodeMedia | PostItem): media is ShortcodeMedia => '__typename' in media;
-
-// tslint:disable-next-line:ban-types
-export function LogIGRequest(method: T): T {
- return ((...args: any[]) => {
- try {
- return method(...args);
- } catch (e) {
- Alert.add('Looks like Instagram has figured out you are using a downloader.
The download may not work for the next time');
- throw e;
- }
- }) as unknown as T;
-}
-
-/**
- * Get the media file links for a post
- * @param postURL The post URL
- * @param index null for every media, -1 for the image in case of a GraphSidecar any other index for the index of the GraphSidecar
- */
-export async function getMedia(postURL: string, index: number | null = null): Promise {
- const response = await makeRequest(postURL);
-
- return {
- mediaURL: extractImage(response, index),
- accountName: extractAccountName(response),
- timestamp: extractTakenTimestamp(response),
- originalResponse: response,
- };
-}
-
-/**
- * Make a request to the instagram API and return the result
- * @param postURL The api url to query
- */
-export const makeRequest = LogIGRequest(async (postURL: string): Promise => {
- const response = await (await fetch(`${postURL}?__a=1`)).json() as PostQuery | GraphqlQuery;
- if ('graphql' in response && response.graphql) {
- return response.graphql.shortcode_media;
- }
-
- return (response as PostQuery).items[0];
-});
-
-/**
- * Extract the account name of an API response
- */
-export function extractAccountName(shortcodeMedia: ShortcodeMedia | PostItem): string {
- const user = isShortcodeMedia(shortcodeMedia) ? shortcodeMedia.owner: shortcodeMedia.user
-
- return user.username;
-}
-
-export function extractImage(shortcodeMedia: ShortcodeMedia | PostItem, index: number | null = null): string[] {
- let mediaURL: string[];
-
- if (isShortcodeMedia(shortcodeMedia)) {
- if (shortcodeMedia.__typename === 'GraphImage') {
- mediaURL = [shortcodeMedia.display_url];
- } else if (shortcodeMedia.__typename === 'GraphVideo') {
- mediaURL = [shortcodeMedia.video_url];
- } else if (index === -1) {
- mediaURL = [shortcodeMedia.display_url];
- } else if (index === null) {
- mediaURL = [];
- for (const i of Array(shortcodeMedia.edge_sidecar_to_children.edges.length).keys()) {
- mediaURL.push(
- extractImage(shortcodeMedia, i)[0],
- );
- }
- } else {
- mediaURL = extractImage(shortcodeMedia.edge_sidecar_to_children.edges[index].node as ShortcodeMedia);
- }
- } else {
- const imageIndex = index === -1 ? 0 : index;
- if (shortcodeMedia.video_versions) {
- // Post is a video
- mediaURL = [shortcodeMedia.video_versions[0].url];
- } else if (shortcodeMedia.image_versions2) {
- // Post is an image
- mediaURL = [shortcodeMedia.image_versions2.candidates[0].url];
- } else {
- // Multiple posts are present and optionally uses an index
- const urls = shortcodeMedia.carousel_media!.map(media => {
- const mediaObject = media.video_versions ? media.video_versions[0] : media.image_versions2.candidates[0];
-
- return mediaObject.url;
- });
- mediaURL = imageIndex != null ? [urls[imageIndex]] : urls;
- }
- }
-
- return mediaURL;
-}
-
-export function extractTakenTimestamp(shortcodeMedia: ShortcodeMedia | PostItem): number {
- if(isShortcodeMedia(shortcodeMedia)) {
- return shortcodeMedia.taken_at_timestamp;
- } else {
- return 0;
- }
-}
-
-export interface ZippedFile {
- name: string
- lastModified: Date
- input: string | Blob
- fetchResponse: Response
-}
-
-export async function downloadBulk(urls: string[], accountName: string, callback?: any): Promise {
- let files: ZippedFile[] = [];
- let error: boolean = false;
-
- // Used for precise download progress calculation
- let urlsWithoutTimestamp = [].concat.apply([], urls).flatMap(val => {
- return typeof val == "number" ? [] : [val];
- });
-
- let urlsOnlyTimestamp = [];
- for (let i = 0; i < urls.length; i++) {
- // This loop is for inner-array
- for (var j = 0, l2 = urls[i].length; j < l2; j++) {
- // Accessing each elements of inner-array
- if (typeof urls[i][j] === "string" && typeof urls[i][j] !== "number") {
- urlsOnlyTimestamp.push(urls[i][urls[i].length - 1]);
- }
- }
- }
- // Flaten timestamp array
- urlsOnlyTimestamp = [].concat.apply([], urlsOnlyTimestamp);
-
- let timeStarted: string = new Date().toISOString();
-
- for (const [imageIndex, url] of urlsWithoutTimestamp.entries()) {
- const response = await fetch(url, {
- headers: {
- 'User-Agent': 'curl/7.64.1',
- }
- }).then(function (response) {
- if (response.ok) {
- return response;
- } else {
- return Promise.reject(response);
- }
- }).catch(function () {
- console.warn('Cannot fetch a media url');
- })
-
- // If cannot fetch, warn
- if (response) {
- error = false;
-
- files.push({
- name: getImageId(url),
- lastModified: new Date(urlsOnlyTimestamp[imageIndex] * 1000),
- input: await response.blob(),
- fetchResponse: response
- });
- } else {
- error = true;
- }
-
- callback({
- percent: Number((Math.round(((imageIndex + 1) / urlsWithoutTimestamp.length) * 100)).toFixed(2)),
- isFirst: imageIndex === 0,
- isLast: imageIndex + 1 === urlsWithoutTimestamp.length,
- type: 'download',
- currentMediaPos: imageIndex + 1,
- totalMediaFiles: urlsWithoutTimestamp.length,
- started: timeStarted,
- error: error
- });
- }
-
- if (!error) {
- await _downloadZIP(files, accountName, callback);
- }
-
- return error;
-}
-
-/**
- * Download the zip file
- * @param zip The JSZip file which should be downloaded
- * @param accountName The account name
- */
-export async function _downloadZIP(files: ZippedFile[], accountName: string, callback?: any): Promise {
- let isFirst = true;
- // Calculate total download size by summing up the HTTP header `Content-Length` + the length
- // of the UTF-8 encoded file name + 92 Bytes
- let totalBytes = 0;
- files.forEach(file => {
- const contentLength = +file.fetchResponse.headers.get('Content-Length');
- const fileNameSizeInBytes = (new TextEncoder().encode(file.name)).length;
- totalBytes += contentLength + fileNameSizeInBytes + 92;
- });
- totalBytes += 22;
-
- const response = downloadZip(files);
- const reader = response.body.getReader();
-
- let receivedBytes = 0;
- const chunks = [];
- while (true) {
- const { done, value } = await reader.read();
-
- if (done) {
- isFirst = false;
- break;
- }
-
- chunks.push(value);
- receivedBytes += value.length;
-
- //console.log(`Received ${receivedBytes} of ${totalBytes} Bytes -> ${(receivedBytes / totalBytes * 100).toFixed()} %`);
-
- callback({
- percent: Number((receivedBytes / totalBytes * 100).toFixed()),
- isFirst,
- isLast: (receivedBytes / totalBytes * 100) === 100,
- type: 'compression',
- error: false
- });
- }
-
- //console.log(['isFirst', isFirst]);
- //console.log(['isLast', (receivedBytes / totalBytes * 100) === 100]);
-
- const blob = new Blob(chunks);
-
- if (accountName) {
- saveData(blob, `${accountName}.zip`);
- } else {
- saveData(blob, 'bulk_download.zip');
- }
-}
-
-/**
- * Gets the image name based on the url of the image
- * @param url the url of the image or video
- * @returns the image/video name
- */
-function getImageId(url: string): string {
- // tslint:disable-next-line:no-non-null-assertion
- return url.split('?')[0]!.split('/').pop()!;
-}
\ No newline at end of file
diff --git a/src/helpers/getDataFromIGUrl.ts b/src/helpers/getDataFromIGUrl.ts
deleted file mode 100644
index c43931e..0000000
--- a/src/helpers/getDataFromIGUrl.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import getUrlParams from "./getUrlParams"
-
-export default async function getDataFromIGUrl(url: string, query: string, neededFilename: string, posts = []): Promise {
- return new Promise((resolve, reject) => fetch(url + query)
- .then(response => {
- if (response.status !== 200) {
- throw `${response.status}: ${response.statusText}`
- }
-
- response.text().then(data => {
- let jsonData = JSON.parse(data)
- posts = posts.concat(jsonData.data)
-
- if (jsonData.data.user.edge_owner_to_timeline_media.page_info.has_next_page && !data.includes(neededFilename)) {
- //let urlQueryObj = getUrlParams(url)
-
- let parsedQueryParams = JSON.parse(query)
- parsedQueryParams.after = jsonData.data.user.edge_owner_to_timeline_media.page_info.end_cursor
-
- getDataFromIGUrl(url, String(`${JSON.stringify(parsedQueryParams)}`), neededFilename, posts).then(resolve).catch(reject)
- } else {
- resolve(posts)
- }
- }).catch(reject)
- }).catch(reject))
-}
\ No newline at end of file
diff --git a/src/helpers/getFileNameWithoutExtension.ts b/src/helpers/getFileNameWithoutExtension.ts
deleted file mode 100644
index 5fd4310..0000000
--- a/src/helpers/getFileNameWithoutExtension.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export default function getFileNameWithoutExtension(url: string) {
- if (typeof url !== 'string') throw new Error('url must be a string');
- // Remove the QueryString
- return url.replace(/\?.*$/, '')
- // Extract the filename
- .split('/').pop()
- // Remove the extension
- .replace(/\.[^.]+$/, '')
-}
\ No newline at end of file
diff --git a/src/helpers/getTranslateXY.ts b/src/helpers/getTranslateXY.ts
deleted file mode 100644
index ea5c82c..0000000
--- a/src/helpers/getTranslateXY.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export default function getTranslateXY(element) {
- const style = window.getComputedStyle(element)
- const matrix = new DOMMatrixReadOnly(style.transform)
- return {
- translateX: matrix.m41,
- translateY: matrix.m42
- }
-}
\ No newline at end of file
diff --git a/src/helpers/getUrlParams.ts b/src/helpers/getUrlParams.ts
deleted file mode 100644
index ca10ad9..0000000
--- a/src/helpers/getUrlParams.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-export default function getUrlParams(urlOrQueryString: string): any {
- let i = 0
- if ((i = urlOrQueryString.indexOf('?')) >= 0) {
- const queryString = urlOrQueryString.substring(i + 1)
-
- if (queryString) {
- return queryString
- .split('&')
- .map(function (keyValueString) { return keyValueString.split('=') })
- .reduce(function (urlParams, [key, value]) {
- urlParams[key] = decodeURI(value)
- return urlParams
- }, {})
- }
- }
-
- return {}
-}
\ No newline at end of file
diff --git a/src/helpers/getVideoUrl.ts b/src/helpers/getVideoUrl.ts
index 6666b82..a03edcc 100644
--- a/src/helpers/getVideoUrl.ts
+++ b/src/helpers/getVideoUrl.ts
@@ -1,3 +1,4 @@
+import getDataFromUrl from "../helpers/getDataFromUrl"
import getPath from "../helpers/getPath"
async function getVideoUrl(el: HTMLVideoElement, callback: any) {
@@ -7,56 +8,67 @@ async function getVideoUrl(el: HTMLVideoElement, callback: any) {
return false
}
+
+ // Try another approach
+ var elSection:any = el.closest('section');
- const instanceKey = Object.keys(el).find(key => key.includes('Instance') || key.includes('Fiber'))
- const $react = el[instanceKey]
-
- // Found mpd manifest, so extract our magic
- if ($react.return.return.memoizedProps.manifest) {
- var domManifestParser = new DOMParser().parseFromString($react.return.return.memoizedProps.manifest, "text/xml")
- var s = Array.from(domManifestParser.querySelectorAll('Representation[mimeType="video/mp4"][FBQualityClass="hd"]')).map(function l(_e) {
- var z, nope
- return {
- quality: _e.getAttribute("FBQualityClass"),
- bandwidth: parseInt(_e.getAttribute("bandwidth")),
- baseUrl: null === (nope = null === (z = _e.querySelector("BaseURL")) || void 0 === z ? void 0 : z.textContent) || void 0 === nope ? void 0 : nope.trim()
- }
- }).filter(function (e) {
- return e.baseUrl
- })
-
- var lol
- callback(s.sort(function compare(x, y) {
- return "hd" === x.quality && "hd" !== y.quality ? -1 : "hd" !== x.quality && "hd" === y.quality ? 1 : y.bandwidth - x.bandwidth
- }), null === (lol = s[0]) || void 0 === lol ? void 0 : lol.baseUrl)
+ const instanceKey = Object.keys(elSection).find(key => key.includes('Instance') || key.includes('Fiber'))
+ const $react = elSection[instanceKey]
+
+ if ($react && $react.return && $react.return.return && $react.return.return.return && $react.return.return.return.memoizedProps && $react.return.return.return.memoizedProps.post && $react.return.return.return.memoizedProps.post.videoUrl) {
+ callback($react.return.return.return.memoizedProps.post.videoUrl)
} else {
- let $videoURL: string | any[]
- let $videoType: string
+ const instanceKey = Object.keys(el).find(key => key.includes('Instance') || key.includes('Fiber'))
+ const $react = el[instanceKey]
- if ($react.return.return.memoizedProps.hdSrc) {
- $videoURL = $react.return.return.memoizedProps.hdSrc
- $videoType = 'hd'
- } else if ($react.return.return.memoizedProps.sdSrc) {
- $videoURL = $react.return.return.memoizedProps.sdSrc
- $videoType = 'sd'
- } else if ($react.return.return.memoizedProps.children[0].props.fallbackSrc) {
- $videoURL = $react.return.return.memoizedProps.children[0].props.fallbackSrc
- $videoType = 'fallback'
+ // Found mpd manifest, so extract our magic
+ if ($react.return.return.memoizedProps.manifest) {
+ var domManifestParser = new DOMParser().parseFromString($react.return.return.memoizedProps.manifest, "text/xml")
+
+ var s = Array.from(domManifestParser.querySelectorAll('Representation[mimeType="video/mp4"][FBQualityClass="hd"]')).map(function l(_e) {
+ var z, nope
+ return {
+ quality: _e.getAttribute("FBQualityClass"),
+ bandwidth: parseInt(_e.getAttribute("bandwidth")),
+ baseUrl: null === (nope = null === (z = _e.querySelector("BaseURL")) || void 0 === z ? void 0 : z.textContent) || void 0 === nope ? void 0 : nope.trim()
+ }
+ }).filter(function (e) {
+ return e.baseUrl
+ })
+
+ var lol
+ callback(s.sort(function compare(x, y) {
+ return "hd" === x.quality && "hd" !== y.quality ? -1 : "hd" !== x.quality && "hd" === y.quality ? 1 : y.bandwidth - x.bandwidth
+ }), null === (lol = s[0]) || void 0 === lol ? void 0 : lol.baseUrl)
} else {
- $videoURL = null
- $videoType = null
- }
+ let $videoURL: string | any[]
+ let $videoType: string
- if ($videoURL.length > 80) {
- if ($videoType == 'fallback') {
- /* Fix error network error since mai 2021 cannot download */
- let fixedUrl = "https://scontent.cdninstagram.com" + getPath($react.return.return.memoizedProps.children[0].props.fallbackSrc, "unknown")
- callback(fixedUrl)
+ if ($react.return.return.memoizedProps.hdSrc) {
+ $videoURL = $react.return.return.memoizedProps.hdSrc
+ $videoType = 'hd'
+ } else if ($react.return.return.memoizedProps.sdSrc) {
+ $videoURL = $react.return.return.memoizedProps.sdSrc
+ $videoType = 'sd'
+ } else if ($react.return.return.memoizedProps.children[0].props.fallbackSrc) {
+ $videoURL = $react.return.return.memoizedProps.children[0].props.fallbackSrc
+ $videoType = 'fallback'
} else {
- callback($videoURL)
+ $videoURL = null
+ $videoType = null
+ }
+
+ if ($videoURL.length > 80) {
+ if ($videoType == 'fallback') {
+ /* Fix error network error since mai 2021 cannot download */
+ let fixedUrl = "https://scontent.cdninstagram.com" + getPath($react.return.return.memoizedProps.children[0].props.fallbackSrc, "unknown")
+ callback(fixedUrl)
+ } else {
+ callback($videoURL)
+ }
+ } else {
+ callback(null)
}
- } else {
- callback(null)
}
}
diff --git a/src/helpers/saveData.ts b/src/helpers/saveData.ts
deleted file mode 100644
index 36c0b91..0000000
--- a/src/helpers/saveData.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-const saveData = (function () {
- let existsElement = document.getElementById('instantgram-bulk-downloader-download');
- if (existsElement) {
- existsElement.remove();
- }
-
- let a = document.createElement('a');
- a.id = 'instantgram-bulk-downloader-download';
- document.body.appendChild(a);
- a.setAttribute('style', 'display: none');
- return function (data, fileName) {
- const url = window.URL.createObjectURL(data);
- a.href = url;
- a.download = fileName;
- a.click();
- window.URL.revokeObjectURL(url);
- };
-}());
-
-export default saveData;
\ No newline at end of file
diff --git a/src/helpers/validURL.ts b/src/helpers/validURL.ts
deleted file mode 100644
index 572a0e1..0000000
--- a/src/helpers/validURL.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export default function validURL(urlString: string): boolean {
- const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
- '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
- '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
- '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
- '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
- '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
-
- return pattern.test(urlString);
-}
\ No newline at end of file