Skip to content

Commit

Permalink
v12.1.0 🚀 Launch to the moon
Browse files Browse the repository at this point in the history
[instangram] Support for the latest backend version of instagram.
  • Loading branch information
saschaheim committed Sep 30, 2022
1 parent c529672 commit d86a91f
Show file tree
Hide file tree
Showing 13 changed files with 422 additions and 190 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# <img style="float: left; vertical-align: bottom; " width="35" src="https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg"> [instantgram] v12.0.0 :fire: Rebirth of Instantgram
![GitHub release](https://img.shields.io/badge/release-v12.0.0-green)
# <img style="float: left; vertical-align: bottom; " width="35" src="https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg"> [instantgram] v12.1.0 :rocket: Launch to the moon
![GitHub release](https://img.shields.io/badge/release-v12.1.0-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/)
Expand Down Expand Up @@ -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
- v12.1.0 - [instangram] Support for the latest backend version of instagram.
- v12.0.0 - [instangram] Rewrite of instantgram to support last backend of insta. \
Profile page bulk downloader dropped because insta deleted all api around them.
Maybe there is a possibility in the future but unfortunately not now.
Expand Down
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/de-de/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/en-us/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/es-ar/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lang/pt-br/index.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instantgram",
"version": "12.0.0",
"version": "12.1.0",
"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/",
Expand All @@ -24,16 +24,15 @@
"build": "npm run build:webpack && npm run build:release"
},
"devDependencies": {
"@babel/core": "^7.1.6",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-loader": "^8.0.4",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"bookmarkletify": "github:ThinkBIG-Company/bookmarkletify",
"closure-webpack-plugin": "^2.5.0",
"compression-webpack-plugin": "^8.0.0",
"concurrently": "^6.5.1",
"css-loader": "^5.2.7",
Expand Down Expand Up @@ -61,6 +60,7 @@
},
"dependencies": {
"client-zip": "^2.2.2",
"gulp": "^4.0.2"
"detect-browser": "^5.3.0",
"gulp": "^3.9.1"
}
}
2 changes: 2 additions & 0 deletions src/App.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export type Program = {
VERSION: string

browser: any

hostname: string
path: string

Expand Down
2 changes: 1 addition & 1 deletion src/_langs/partials/button.html

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import { Modal } from './components/Modal'
import Update from './modules/Update'
import localize from './helpers/localize'

import { detect } from "detect-browser"
// Init browser detection
const browser = detect()

console.clear()

const program: Program = {
VERSION: process.env.VERSION as string,

browser: browser,

hostname: window.location.hostname,
path: window.location.pathname,

Expand All @@ -27,6 +33,12 @@ const program: Program = {

if (process.env.DEV) {
console.info(['Developer Mode Caution!', program])

if (program.browser) {
console.info(['Browser Name', program.browser.name])
console.info(['Browser Version', program.browser.version])
console.info(['Browser OS', program.browser.os])
}
}

/* ===============================
Expand Down
192 changes: 143 additions & 49 deletions src/modules/FeedScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export class FeedScanner implements Module {
let selectedCarouselMediaSlideIndex: number
let isLastMedia: boolean = false

// Container
let $container = document.querySelector("main")

// Selected Article
let $article: Element

Expand All @@ -37,21 +34,17 @@ export class FeedScanner implements Module {
// Media selector
let mediaSelector: string = "._aagv"

let carouselLeftButtonSelector: string = "._aahh"
let carouselRightButtonSelector: string = "._aahi"
let carouselLeftButtonSelector: string = "._9zm0"
let carouselRightButtonSelector: string = "._9zm2"

// Scanner begins
if (mediaEl == null) {
$container = document.querySelector("main section > div:first-child > div:last-child > div:first-child > div:first-child")
//$articles = $container.querySelectorAll("article")
$articles = document.getElementsByTagName("article")

let mediaElInfos: any[] = []
for (let i1 = 0; i1 < $articles.length; i1++) {
let isCarousel = $articles[i1].querySelector(carouselLeftButtonSelector) !== null || $articles[i1].querySelector(carouselRightButtonSelector) !== null

//console.log([`article ${i1 + 1}`, $articles[i1]])
//console.log([`isCarousel ${i1 + 1}`, isCarousel])

let mediaEl: any
if (isCarousel) {
mediaEl = $articles[i1].querySelector(":first-child > :nth-child(2) > :first-child ul > li:nth-child(2) img[crossorigin='anonymous']")
Expand Down Expand Up @@ -86,11 +79,15 @@ export class FeedScanner implements Module {
).filter((el: any) => el.firstChild != null && el.classList.length > 0)

if (carouselMediaSlideElements != null && carouselMediaSlideElements.length > 0) {
let carouselControlsArray: any = ($article as HTMLElement).querySelectorAll(":first-child > div:nth-child(2) > div > div:nth-child(2) > div")
let carouselControlsArray: any = Array.from(
($article as HTMLElement).querySelectorAll(
":first-child > div:nth-child(2) > div > div:nth-child(2) > div"
)
).filter((el: any) => el.classList.length <= 2)

// Detect current image index of carousel
for (let i = 0; i < carouselControlsArray.length; i++) {
if (carouselControlsArray[i].classList.length >= 2) {
if (carouselControlsArray[i].classList.length == 2) {
selectedCarouselMediaSlideIndex = i
}

Expand Down Expand Up @@ -140,60 +137,157 @@ export class FeedScanner implements Module {
}
break
case 5:
if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 3) {
mediaEl = M[Math.ceil(M.length / 2)]
if (program.browser.name == "firefox") {
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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 3) {
mediaEl = M[Math.ceil(M.length / 2)]
} else {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
}
break
case 6:
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 == 2) {
mediaEl = M[Math.ceil(M.length / 2) - 1]
if (program.browser.name == "firefox") {
if (S == 4) {
mediaEl = M[Math.ceil(M.length / 2)]
} else if (S == 3) {
mediaEl = M[Math.ceil(M.length / 2) - 1]
} else if (S == 2) {
mediaEl = M[Math.ceil(M.length / 2) - 1]
} else {
mediaEl = M[Math.ceil(M.length / 2)]
}
} else {
mediaEl = M[Math.ceil(M.length / 2)]
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 == 2) {
mediaEl = M[Math.ceil(M.length / 2) - 1]
} else {
mediaEl = M[Math.ceil(M.length / 2)]
}
}
break
case 7:
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)]
if (program.browser.name == "firefox") {
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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
}
break
case 8:
if (S == 6) {
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)]
if (program.browser.name == "firefox") {
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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
if (S == 6) {
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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
}
break
case 9:
if (program.browser.name == "firefox") {
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 == 6) {
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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
}
break
case 10:
if (S == 8) {
mediaEl = M[Math.ceil(M.length / 2)]
} 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)]
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 == 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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
if (S == 8) {
mediaEl = M[Math.ceil(M.length / 2)]
} 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 {
mediaEl = M[Math.ceil(M.length / 2) - 1]
}
}
break
}
Expand Down
Loading

0 comments on commit d86a91f

Please sign in to comment.