Skip to content

Commit

Permalink
v2022.12.10 🤟 Service update
Browse files Browse the repository at this point in the history
[instangram] Fixed issue #27 [Stories completely nonfunctional].
Fixed some other bugs.
  • Loading branch information
saschaheim committed Dec 10, 2022
1 parent b85b172 commit 200e081
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 27 deletions.
6 changes: 4 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] v2022.10.28 :rocket: Launch into the sun
![GitHub release](https://img.shields.io/badge/release-v2022.10.28-green)
# <img style="float: left; vertical-align: bottom; " width="35" src="https://upload.wikimedia.org/wikipedia/commons/4/4c/Typescript_logo_2020.svg"> [instantgram] v2022.12.10 :rocket: Launch into the sun
![GitHub release](https://img.shields.io/badge/release-v2022.12.10-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,8 @@ With this version we support all modern browsers that have ECMAScript 2015 (es6)
Read [CONTRIBUTING.md](CONTRIBUTING.md) for more information. :heart:

## Changelog
- v2022.12.10 - [instangram] Fixed issue #27 [Stories completely nonfunctional]. \
Fixed some other bugs.
- v2022.10.28 - [instangram] Support for the latest backend version of instagram. \
New versioning.
Fixed stories video detection. #23
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instantgram",
"version": "2022.10.28",
"version": "2022.12.10",
"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 Down
2 changes: 1 addition & 1 deletion src/_langs/partials/button.html

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions src/helpers/getDataFromIGUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ export default async function getDataFromIGUrl(url: string, query: string, neede
let jsonData = JSON.parse(data)
posts = posts.concat(jsonData.data)

console.log(data.includes(neededFilename))

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)
console.log(parsedQueryParams)
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)
Expand Down
4 changes: 4 additions & 0 deletions src/modules/FeedScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ export class FeedScanner implements Module {
}
}

if (mediaType == MediaType.Image || mediaType == MediaType.Video && mediaEl) {
found = true
}

callback(found, mediaEl, mediaType, program)
} catch (e) {
console.error(this.getName() + "()", `[instantgram] ${program.VERSION}`, e)
Expand Down
23 changes: 15 additions & 8 deletions src/modules/MediaScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ export class MediaScanner implements Module {
}
let mediaURL: string = null

let selectedCarouselIndex: number

// Articles
var $articles: Element | NodeListOf<Element>

// Handle specific modules
if (program.regexProfilePath.test(program.path)) {
found = false
Expand All @@ -55,6 +50,10 @@ export class MediaScanner implements Module {
new StoryScanner().execute(program, function (_scannerFound: boolean, foundMediaElem: any, foundMediaType: MediaType, _scannerProgram: Program) {
mediaObj.mediaEl = foundMediaElem
mediaObj.mediaType = foundMediaType

if (_scannerFound) {
program.foundByModule = new StoryScanner().getName()
}
})
}

Expand All @@ -66,13 +65,21 @@ export class MediaScanner implements Module {
new FeedScanner().execute(program, function (_scannerFound: boolean, foundMediaElem: any, foundMediaType: MediaType, _scannerProgram: Program) {
mediaObj.mediaEl = foundMediaElem
mediaObj.mediaType = foundMediaType

if (_scannerFound) {
program.foundByModule = new FeedScanner().getName()
}
})
}

if (program.regexPostPath.test(program.path)) {
new PostScanner().execute(program, isModal, function (_scannerFound: boolean, foundMediaElem: any, foundMediaType: MediaType, _scannerProgram: Program) {
mediaObj.mediaEl = foundMediaElem
mediaObj.mediaType = foundMediaType

if (_scannerFound) {
program.foundByModule = new PostScanner().getName()
}
})
}
}
Expand All @@ -89,14 +96,12 @@ export class MediaScanner implements Module {
found = true
program.foundImage = true
program.foundVideo = false
program.foundByModule = this.getName()

callback(found, mediaURL, program)
} else {
found = false
program.foundImage = false
program.foundVideo = false
program.foundByModule = undefined

callback(found, null, program)
}
Expand All @@ -116,7 +121,6 @@ export class MediaScanner implements Module {
found = true
program.foundImage = false
program.foundVideo = true
program.foundByModule = that.getName()

let videoURL
if (typeof callbackData === 'string' || callbackData instanceof String) {
Expand All @@ -125,6 +129,9 @@ export class MediaScanner implements Module {
videoURL = callbackData[0].baseUrl && callbackData[0].baseUrl.length > 80 ? callbackData[0].baseUrl : null
}

/* Fix error network error since mai 2021 cannot download */
videoURL = "https://scontent.cdninstagram.com" + getPath(videoURL, "unknown")

if (videoURL) {
callback(found, videoURL, program)
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/modules/PostScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ export class PostScanner implements Module {
}
}

if (mediaType == MediaType.Image || mediaType == MediaType.Video && mediaEl) {
found = true
}

callback(found, mediaEl, mediaType, program)
} catch (e) {
console.error(this.getName() + "()", `[instantgram] ${program.VERSION}`, e)
Expand Down
7 changes: 6 additions & 1 deletion src/modules/StoryScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ export class StoryScanner implements Module {
let $container = document.querySelector("main")

// Scanner begins
$container = document.querySelector("body > div")
$container = document.querySelector("body > div:nth-child(2)")

let storys = $container.querySelectorAll("section > div > div > div")

for (let i = 0; i < (<any>storys).length; i++) {
let scaleX = Number((Math.round((storys[i].getBoundingClientRect().width / (<HTMLElement>storys[i]).offsetWidth) * 100) / 100).toFixed(2))

Expand Down Expand Up @@ -59,6 +60,10 @@ export class StoryScanner implements Module {
}
}

if (mediaType == MediaType.Image || mediaType == MediaType.Video && mediaEl) {
found = true
}

callback(found, mediaEl, mediaType, program)
} catch (e) {
console.error(this.getName() + "()", `[instantgram] ${program.VERSION}`, e)
Expand Down

0 comments on commit 200e081

Please sign in to comment.