a&&(a=o,n=t[e][0])}return n.length>0&&n}return!!(e.hasAttribute("src")&&e.getAttribute("src").length>0)&&e.getAttribute("src")}(m.mediaEl);"string"==typeof s&&(p=s),null!=p&&p.length>10?(d=!0,t.foundImage=!0,t.foundVideo=!1,t.foundByModule=this.getName(),i(d,p,t)):(d=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(d,null,t));break;case e.Video:if(void 0===m.mediaEl.src||0==m.mediaEl.src.length?(m.mediaEl=m.mediaEl.querySelectorAll("source"),p=m.mediaEl[0].src):p=m.mediaEl.src,null!=p&&p.length>10){let e=this;r(m.mediaEl,(function(o){let a;d=!0,t.foundImage=!1,t.foundVideo=!0,t.foundByModule=e.getName(),a="string"==typeof o||o instanceof String?o:o[0].baseUrl&&o[0].baseUrl.length>80?o[0].baseUrl:null,a?i(d,a,t):(e.modal.heading=[`[instantgram] v${t.VERSION}
`],e.modal.content=[g("index#program#blob@alert_cannotDownload")],e.modal.contentStyle="text-align:center",e.modal.buttonList=[{active:!0,text:"Ok"}],e.modal.open(),i(d,null,t))}))}else d=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(d,null,t);break;default:d=!1,t.foundImage=!1,t.foundVideo=!1,t.foundByModule=void 0,i(d,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 a=(t+"").match(e);return a?(o?a[1]||"==":"")+'"'+(a[2]+".0.0").match(/\d+(?:\.\d+){0,2}/)[0].replace(/(?:^|\.)(\d+)/g,(function(e,t){return Array(9-t.length).join("0")+t}))+(a[3]||"~")+'"':o?"==0":1}return function(e,...o){e=t(e,null);for(var a,n=1;a=arguments[n++];)if(!new Function("return "+e+t(a,1))())return!1;return!0}}();function u(e){console.warn(g("modules.update@consoleWarnOutdatedInfo")),console.warn(g("modules.update@consoleWarnOutdatedInfoVersions").replace("${data.version}",e.version).replace("${data.onlineVersion}",e.onlineVersion))}const f=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)&&u(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,a=o.match(/(\*|\d+(\.\d+){0,2}(\.\*)?)+/gm)[0],n=new Date;if(n.setTime(n.getTime()+216e5),window.localStorage.setItem("instantgram",JSON.stringify({version:e,onlineVersion:a,lastVerification:Date.now(),dateExpiration:n.valueOf()})),console.info(g("modules.update@determineIfGetUpdateIsNecessary_updated")),h(a,"> "+e)){new i({heading:[`[instantgram] v${e}
`],content:[`Es ist ein neues Update verfügbar v${a}
`,"
","
","Changelog
"+o.split("Changelog ")[1]+"","
",""+g("modules.update@determineIfGetUpdateIsNecessary_@load_update")+"",""],buttonList:[{active:!0,text:"Ok"}]}).open(),u(JSON.parse(window.localStorage.getItem("instantgram")))}else console.info(window.localStorage.getItem("instantgram"))})).catch((e=>{console.error("Error:",e)}))};var w=function(e,t,o){if(o||2===arguments.length)for(var a,n=0,i=t.length;n[instantgram] ProfilePage downloader v${O.VERSION}`],content:[g("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:[g("index#program@alert_dontFound")],contentStyle:"text-align:center",buttonList:[{active:!0,text:"Ok"}]}).open()})),f(O.VERSION)):new i({heading:[`[instantgram] v${O.VERSION}
`],content:[g("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 f30254e..f8330ed 100644
--- a/index.html
+++ b/index.html
@@ -94,7 +94,7 @@
Instantgram
☁️ A bookmarklet for downloading images from Instagram.
- [instantgram 12.1.0]
+ [instantgram 2022.10.28]
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 6b340c9..ab5b53a 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 12.1.0]
+ [instantgram 2022.10.28]
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 f30254e..f8330ed 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 12.1.0]
+ [instantgram 2022.10.28]
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 f2c9939..5a1d1d0 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 12.1.0]
+ [instantgram 2022.10.28]
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 3122bba..758c509 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 12.1.0]
+ [instantgram 2022.10.28]
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 d4f914d..7468e58 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "instantgram",
- "version": "12.1.0",
+ "version": "2022.10.28",
"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 5b4474f..b37174e 100644
--- a/src/_langs/partials/button.html
+++ b/src/_langs/partials/button.html
@@ -1 +1 @@
-[instantgram 12.1.0]
\ No newline at end of file
+[instantgram 2022.10.28]
\ No newline at end of file
diff --git a/src/helpers/getBlobVideoUrl.ts b/src/helpers/getBlobVideoUrl.ts
deleted file mode 100644
index aee1112..0000000
--- a/src/helpers/getBlobVideoUrl.ts
+++ /dev/null
@@ -1,129 +0,0 @@
-import getDataFromUrl from "./getDataFromUrl"
-import getDataFromIGUrl from "./getDataFromIGUrl"
-import getFileNameWithoutExtension from "../helpers/getFileNameWithoutExtension"
-
-async function getBlobVideoUrl(el: HTMLVideoElement, article: any, selectedControlIndex: number, callback: any) {
- // First try fastest method
- const instanceKey = Object.keys(el).find(key => key.includes('Instance') || key.includes('Fiber'))
- const $react = el[instanceKey]
- const videoLink = $react.return.memoizedProps.fallbackSrc
-
- if (videoLink) {
- callback(videoLink)
- return true
- // If first method didnt work try second approach runs very slow
- } else {
- let isVideoFromSeries = (selectedControlIndex != null) ? true : false
- let videoPosterFilename = getFileNameWithoutExtension(el.poster)
-
- if (process.env.DEV) {
- console.log(['getBlobVideoUrl(): el', el])
- console.log(['getBlobVideoUrl(): el src', el.poster])
- console.log(['getBlobVideoUrl(): hasArticle', article !== null])
- console.log(['getBlobVideoUrl(): article', article])
- console.log(['getBlobVideoUrl(): isVideoFromSeries', isVideoFromSeries])
- console.log(['getBlobVideoUrl(): selectedControlIndex', selectedControlIndex])
- console.log(['getBlobVideoUrl(): videoPosterFilename', videoPosterFilename])
- }
-
- if (article !== null) {
- /* Step 1 */
- /* Fetch user id from element */
- let userId = null
- let userProfileUrl = ''
- if (article !== undefined && article.length > 0) {
- let articleClassListLengths = []
- for (let i = 0; i < article.length; i++) {
- articleClassListLengths[i] = article[i].classList.length
- }
- let newArticleIndex = articleClassListLengths.indexOf(Math.max(...articleClassListLengths))
- userProfileUrl = (article[newArticleIndex].querySelectorAll('header > div > div > div > div > span > a')[0] as HTMLLinkElement).href
- } else {
- userProfileUrl = (article.querySelectorAll('header > div > div > div > div > span > a')[0] as HTMLLinkElement).href
- }
-
- if (process.env.DEV) {
- console.log(['getBlobVideoUrl(): userProfileUrl', userProfileUrl])
- }
-
- let userProfileUrlResponseData = await getDataFromUrl(userProfileUrl)
- if (userProfileUrlResponseData) {
- userProfileUrlResponseData = userProfileUrlResponseData.replace(/(\r\n|\n|\r)/gm, '')
-
- 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
- })
- }
- }
-
- if (process.env.DEV) {
- console.log(['getBlobVideoUrl(): userId', userId])
- }
-
- /* Step 2 */
- /* Fetch the user data until the file name is found */
- let videoUrl = null
- if (userId) {
- const query = `{"id":${userId},"first":100}`
- let userMediaFeedPosts = await getDataFromIGUrl('https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables=', query, videoPosterFilename)
- if (process.env.DEV) {
- console.log(['getBlobVideoUrl(): userMediaFeedPosts', userMediaFeedPosts])
- }
-
- if (userMediaFeedPosts) {
- let magicArr = userMediaFeedPosts[userMediaFeedPosts.length - 1]
-
- for (let _fI = 0; _fI < magicArr.user.edge_owner_to_timeline_media.edges.length; _fI++) {
- let GraphEdgeNode = magicArr.user.edge_owner_to_timeline_media.edges[_fI].node
-
- /* Multi Post which can have a video */
- if (isVideoFromSeries) {
- if (GraphEdgeNode.__typename == 'GraphSidecar') {
- if (GraphEdgeNode.hasOwnProperty('edge_sidecar_to_children')) {
- for (let edge in GraphEdgeNode.edge_sidecar_to_children.edges) {
-
- if (GraphEdgeNode.edge_sidecar_to_children.edges[edge].node.__typename == 'GraphVideo') {
- let GraphVideoNode = GraphEdgeNode.edge_sidecar_to_children.edges[edge].node
-
- if (videoPosterFilename == getFileNameWithoutExtension(GraphVideoNode.display_url)) {
- videoUrl = GraphVideoNode.video_url
-
- /* There exists only one node so break it no need to further analyze */
- break
- }
- }
- }
- }
- }
- } else {
- if (GraphEdgeNode.__typename == 'GraphVideo') {
- if (videoPosterFilename == getFileNameWithoutExtension(GraphEdgeNode.display_url)) {
- videoUrl = GraphEdgeNode.video_url
-
- /* There exists only one node so break it no need to further analyze */
- break
- }
- }
- }
- }
- }
- }
-
- callback(videoUrl ? videoUrl : null)
- } else {
- callback(null)
- }
-
- return true
- }
-}
-export default getBlobVideoUrl
\ No newline at end of file
diff --git a/src/helpers/getVideoUrl.ts b/src/helpers/getVideoUrl.ts
new file mode 100644
index 0000000..6666b82
--- /dev/null
+++ b/src/helpers/getVideoUrl.ts
@@ -0,0 +1,65 @@
+import getPath from "../helpers/getPath"
+
+async function getVideoUrl(el: HTMLVideoElement, callback: any) {
+ // No blob video but src return it
+ if (el.src && !el.src.startsWith("blob:")) {
+ callback(el.src)
+
+ return false
+ }
+
+ 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)
+ } else {
+ let $videoURL: string | any[]
+ let $videoType: string
+
+ 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 {
+ $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)
+ }
+ }
+
+ return false
+}
+export default getVideoUrl
\ No newline at end of file
diff --git a/src/modules/MediaScanner.ts b/src/modules/MediaScanner.ts
index e859e77..e81b404 100644
--- a/src/modules/MediaScanner.ts
+++ b/src/modules/MediaScanner.ts
@@ -5,7 +5,7 @@ import { PostScanner } from "./PostScanner"
import { StoryScanner } from "./StoryScanner"
import { Modal } from "../components/Modal"
import { MediaType } from "../model/mediaType"
-import getBlobVideoUrl from "../helpers/getBlobVideoUrl"
+import getVideoUrl from "../helpers/getVideoUrl"
import getHighestResImg from "../helpers/getHighestResImg"
import getPath from "../helpers/getPath"
import localize from "../helpers/localize"
@@ -70,7 +70,7 @@ export class MediaScanner implements Module {
}
if (program.regexPostPath.test(program.path)) {
- new PostScanner().execute(program, isModal, function (_scannerFound: boolean, foundMediaElem: any, foundMediaType: MediaType, _scannerProgram: Program) {
+ new PostScanner().execute(program, isModal, function (_scannerFound: boolean, foundMediaElem: any, foundMediaType: MediaType, _scannerProgram: Program) {
mediaObj.mediaEl = foundMediaElem
mediaObj.mediaType = foundMediaType
})
@@ -110,76 +110,42 @@ export class MediaScanner implements Module {
}
if (mediaURL != null && mediaURL.length > 10) {
- if (mediaURL.indexOf("blob:") !== -1) {
- const that = this
+ let that = this
+ getVideoUrl(mediaObj.mediaEl, function (callbackData: any) {
found = true
program.foundImage = false
program.foundVideo = true
program.foundByModule = that.getName()
- this.modal.heading = [
- `[instantgram] v${program.VERSION}
`,
- ]
- this.modal.content = [
- "" +
- "" +
- "
",
- "" +
- localize("modules.modal@isLoading") +
- "
",
- ]
- this.modal.open()
-
- setTimeout(function () {
- //that.modal.close()
-
- getBlobVideoUrl(mediaObj.mediaEl, $articles, selectedCarouselIndex,
- function (scrapedBlobVideoUrl: string) {
- //clearInterval(loadingDots)
-
- if (scrapedBlobVideoUrl) {
- that.modal.close()
-
- /* Fix error network error since mai 2021 cannot download */
- let _newVideoUrl = "https://scontent.cdninstagram.com" + getPath(scrapedBlobVideoUrl, "unknown")
-
- callback(found, _newVideoUrl, program)
- } else {
- that.modal.heading = [
- `[instantgram] v${program.VERSION}
`,
- ]
- that.modal.content = [
- localize("index#program#blob@alert_cannotDownload"),
- ]
- that.modal.contentStyle = "text-align:center"
- that.modal.buttonList = [
- {
- active: true,
- text: "Ok",
- },
- ]
- that.modal.open()
-
- callback(found, null, program)
- }
- }
- )
- }, 500)
- } else {
- // Fix url timestamp error or signature mismatch
- mediaURL = mediaURL.replace("amp", "&")
-
- found = true
- program.foundImage = false
- program.foundVideo = true
- program.foundByModule = this.getName()
-
- /* Fix error network error since mai 2021 cannot download */
- let _newVideoUrl = "https://scontent.cdninstagram.com" + getPath(mediaURL, "unknown")
-
- callback(found, _newVideoUrl, program)
- }
+ let videoURL
+ if (typeof callbackData === 'string' || callbackData instanceof String) {
+ videoURL = callbackData
+ } else {
+ videoURL = callbackData[0].baseUrl && callbackData[0].baseUrl.length > 80 ? callbackData[0].baseUrl : null
+ }
+
+ if (videoURL) {
+ callback(found, videoURL, program)
+ } else {
+ that.modal.heading = [
+ `[instantgram] v${program.VERSION}
`,
+ ]
+ that.modal.content = [
+ localize("index#program#blob@alert_cannotDownload"),
+ ]
+ that.modal.contentStyle = "text-align:center"
+ that.modal.buttonList = [
+ {
+ active: true,
+ text: "Ok",
+ },
+ ]
+ that.modal.open()
+
+ callback(found, null, program)
+ }
+ })
} else {
found = false
program.foundImage = false
diff --git a/src/modules/PostScanner.ts b/src/modules/PostScanner.ts
index 1086723..18ba43e 100644
--- a/src/modules/PostScanner.ts
+++ b/src/modules/PostScanner.ts
@@ -80,6 +80,7 @@ export class PostScanner implements Module {
selectedCarouselMediaSlideIndex++
if (process.env.DEV) {
+ console.log(["isCarousel", isCarousel])
console.log(["carouselControlsArray", carouselControlsArray])
console.log(["carouselControlsArray.length", carouselControlsArray.length])
console.log(["selectedCarouselMediaSlideIndex", selectedCarouselMediaSlideIndex])
@@ -105,7 +106,7 @@ export class PostScanner implements Module {
if (isLastMedia) {
mediaEl = M[2]
} else {
- // Dont mess with me Instagram!!!
+ // Dont mess with me Instagram!!!
if (isModal && Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0) < 445) {
switch (carouselControlsArray.length) {
case 4:
@@ -262,7 +263,7 @@ export class PostScanner implements Module {
if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 3) {
- mediaEl = M[Math.ceil(M.length / 2)]
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
@@ -271,7 +272,7 @@ export class PostScanner implements Module {
case 6:
if (program.browser.name == "firefox") {
if (S == 4) {
- mediaEl = M[Math.ceil(M.length / 2) - 1]
+ mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 3) {
mediaEl = M[Math.ceil(M.length / 2) - 1]
} else if (S == 2) {
@@ -300,7 +301,7 @@ export class PostScanner implements Module {
} else if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 3) {
- mediaEl = M[Math.ceil(M.length / 2)]
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
@@ -321,13 +322,13 @@ export class PostScanner implements Module {
if (S == 7) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 6) {
- mediaEl = M[Math.ceil(M.length / 2)]
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else if (S == 5) {
- mediaEl = M[Math.ceil(M.length / 2)]
- } else if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2) - 1]
- } else if (S == 3) {
+ } else if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 3) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
@@ -345,16 +346,30 @@ export class PostScanner implements Module {
}
}
break
- case 10:
+ case 9:
if (program.browser.name == "firefox") {
if (S == 9) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 8) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 7) {
- mediaEl = M[Math.ceil(M.length / 2) - 1]
+ mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 6) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else if (S == 5) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 3) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ }
+ } else {
+ if (S == 8) {
+ mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 7) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else if (S == 5) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 4) {
@@ -364,15 +379,40 @@ export class PostScanner implements Module {
} else {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
+ }
+ break
+ case 10:
+ if (program.browser.name == "firefox") {
+ if (S == 9) {
+ mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 8) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else if (S == 7) {
+ mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 6) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else if (S == 5) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else if (S == 4) {
+ mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 3) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ }
} else {
- if (S == 8) {
+ if (S == 9) {
mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 8) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
+ } else if (S == 7) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else if (S == 5) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 4) {
- mediaEl = M[Math.ceil(M.length / 2) - 1]
- } else if (S == 3) {
mediaEl = M[Math.ceil(M.length / 2)]
+ } else if (S == 3) {
+ mediaEl = M[Math.ceil(M.length / 2) - 1]
} else {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
diff --git a/src/modules/StoryScanner.ts b/src/modules/StoryScanner.ts
index 325d8ae..c26f85c 100644
--- a/src/modules/StoryScanner.ts
+++ b/src/modules/StoryScanner.ts
@@ -39,7 +39,7 @@ export class StoryScanner implements Module {
console.log(["isStoryVideo", isVideo])
}
- if (isVideo && isImage) {
+ if (isVideo) {
// Set media type
mediaType = MediaType.Video
diff --git a/src/modules/Update.ts b/src/modules/Update.ts
index 14b4f6c..73a56a4 100644
--- a/src/modules/Update.ts
+++ b/src/modules/Update.ts
@@ -39,15 +39,16 @@ function determineIfGetUpdateIsNecessary(localVersion: string) {
async function update(localVersion: string) {
if (determineIfGetUpdateIsNecessary(localVersion)) {
- console.info(localize('modules.update@determineIfGetUpdateIsNecessary_contacting'))
await fetch('https://www.instagram.com/graphql/query/?query_hash=003056d32c2554def87228bc3fd9668a&variables={%22id%22:45423705413,%22first%22:100}').then(function (response) {
return response.json()
}).then(function (data) {
let changelog = data.data.user.edge_owner_to_timeline_media.edges[0].node.edge_media_to_caption.edges[0].node.text
let onlineVersion = changelog.match(/(\*|\d+(\.\d+){0,2}(\.\*)?)+/gm)[0]
- let limitDate = new Date()
+
// verify update each 2 days
- limitDate.setDate(limitDate.getDate() + 2)
+ let limitDate = new Date()
+ //limitDate.setDate(limitDate.getDate() + 2)
+ limitDate.setTime(limitDate.getTime() + 6 * 60 * 60 * 1000)
window.localStorage.setItem('instantgram', JSON.stringify({
version: localVersion,