Skip to content

Commit

Permalink
add ig story downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
thoriqazzikraa committed Sep 16, 2023
1 parent 947ed23 commit 4e91b04
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const scrape = require("scrape-websitee")
ttsModel,
},
downloader: {
igStory, // (username)
twitterdl2, // (url)
igdl2, // (url)
threads, // (url)
Expand Down
31 changes: 31 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,35 @@ const pickRandom = async (ext) => {
return ext[Math.floor(Math.random() * ext.length)];
};

async function igStory(username) {
try {
const { pkId } = await igStalk(username);
const { data } = await axios.get(
`https://instasupersave.com/api/ig/stories/${pkId}`
);
let result = { status: true, media: [] };
data.result.map((check) => {
if (check.has_audio === true) {
var url = check.video_versions[0].url;
} else {
var res = check.image_versions2.candidates.find(
(media) => media.height <= 3000
);
var url = res.url;
}
result.media.push(url);
});
return result;
} catch (err) {
console.log(err);
const result = {
status: false,
message: "Unknown error occurred.",
};
return result;
}
}

async function truthOrDare(language) {
const lang = language ? language : "id";
try {
Expand Down Expand Up @@ -657,6 +686,7 @@ async function igStalk(username) {
externalUrl: res.external_url,
urlAcc: `https://instagram.com/${username}`,
profilePic: res.hd_profile_pic_url_info.url,
pkId: res.pk_id,
};
return result;
} catch (err) {
Expand Down Expand Up @@ -854,6 +884,7 @@ module.exports = {
ttsModel,
},
downloader: {
igStory,
twitterdl2,
igdl2,
threads,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrape-websitee",
"version": "1.0.36",
"version": "1.0.37",
"description": "Website Scraping",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4e91b04

Please sign in to comment.