snapsave-media-downloader
Advanced tools
Comparing version 1.0.7 to 1.1.0
@@ -54,3 +54,7 @@ var __async = (__this, __arguments, generator) => { | ||
} | ||
return decodeURIComponent(encodeURIComponent(r)); | ||
const fixEncoding = (str) => { | ||
const bytes = new Uint8Array(str.split("").map((char) => char.charCodeAt(0))); | ||
return new TextDecoder("utf-8").decode(bytes); | ||
}; | ||
return fixEncoding(r); | ||
}, getEncodedSnapApp = function(data) { | ||
@@ -63,7 +67,9 @@ return data.split("decodeURIComponent(escape(r))}(")[1].split("))")[0].split(",").map((v) => v.replace(/"/g, "").trim()); | ||
}; | ||
const fbRegex = /(https|http):\/\/(?:(?:www\.facebook\.com\/(?:(?:(?:video\.php)||(?:watch\/))\?v=\d+|(?:[0-9a-zA-Z-_.]+\/(?:(?:video|(post))(?:s))\/)(?:[0-9a-zA-Z-_.]+(?:\/\d+)*)))|(?:fb\.watch\/(?:\w|-)+)|(?:www\.facebook\.com\/reel\/\d+)|(?:www\.facebook\.com\/share\/(v|r)\/[a-zA-Z0-9]+\/)\/?)/; | ||
const igRegex = /((?:https?:\/\/)?(?:www\.)?instagram\.com\/(?:p|reel|reels|tv|stories)\/([^/?#&]+)).*/g; | ||
if (!url.match(fbRegex) && !url.match(igRegex)) return { status: false, msg: "Link Url not valid" }; | ||
const facebookRegex = /(https|http):\/\/(?:(?:www\.facebook\.com\/(?:(?:(?:video\.php)||(?:watch\/))\?v=\d+|(?:[0-9a-zA-Z-_.]+\/(?:(?:video|(post))(?:s))\/)(?:[0-9a-zA-Z-_.]+(?:\/\d+)*)))|(?:fb\.watch\/(?:\w|-)+)|(?:www\.facebook\.com\/reel\/\d+)|(?:www\.facebook\.com\/share\/(v|r)\/[a-zA-Z0-9]+\/)\/?)/; | ||
const instagramRegex = /((?:https?:\/\/)?(?:www\.)?instagram\.com\/(?:p|reel|reels|tv|stories)\/([^/?#&]+)).*/g; | ||
const tiktokRegex = /((?:https?:\/\/)?(?:www\.|m\.|vm\.)?tiktok\.com\/(?:@[^/]+\/video\/\d+|v\/\d+|t\/[\w]+|[\w]+)\/?)/g; | ||
const regexList = [facebookRegex, instagramRegex, tiktokRegex]; | ||
if (!regexList.some((regex) => url.match(regex))) return { status: false, msg: "Link Url not valid" }; | ||
const formData = new URLSearchParams(); | ||
formData.append("url", url); | ||
formData.append("url", /^(https?:\/\/)(?!www\.)([a-z0-9]+)\.[a-z0-9]+\.[a-z]{2,}/i.test(url) ? url : url.replace(/^(https?:\/\/)/, "$&www.")); | ||
const response = yield fetch("https://snapsave.app/action.php?lang=id", { | ||
@@ -86,19 +92,30 @@ method: "POST", | ||
const thumbnail = $("article.media > figure").find("img").attr("src"); | ||
$("tbody > tr").each((_, el) => { | ||
var _a; | ||
const $el = $(el); | ||
const $td = $el.find("td"); | ||
const resolution = $td.eq(0).text(); | ||
let _url = $td.eq(2).find("a").attr("href") || $td.eq(2).find("button").attr("onclick"); | ||
const shouldRender = /get_progressApi/ig.test(_url || ""); | ||
if (shouldRender) { | ||
_url = ((_a = /get_progressApi\('(.*?)'\)/.exec(_url || "")) == null ? void 0 : _a[1]) || _url; | ||
} | ||
const description = $("span.video-des").text().trim(); | ||
if ($("table.table").length) { | ||
$("tbody > tr").each((_, el) => { | ||
var _a; | ||
const $el = $(el); | ||
const $td = $el.find("td"); | ||
const resolution = $td.eq(0).text(); | ||
let _url = $td.eq(2).find("a").attr("href") || $td.eq(2).find("button").attr("onclick"); | ||
const shouldRender = /get_progressApi/ig.test(_url || ""); | ||
if (shouldRender) { | ||
_url = ((_a = /get_progressApi\('(.*?)'\)/.exec(_url || "")) == null ? void 0 : _a[1]) || _url; | ||
} | ||
results.push({ | ||
resolution, | ||
thumbnail, | ||
url: _url, | ||
description, | ||
shouldRender | ||
}); | ||
}); | ||
} else { | ||
let _url = $("a").attr("href") || $("button").attr("onclick"); | ||
results.push({ | ||
resolution, | ||
thumbnail, | ||
url: _url, | ||
shouldRender | ||
description | ||
}); | ||
}); | ||
} | ||
} else { | ||
@@ -105,0 +122,0 @@ $("div.download-items__thumb").each((_, tod) => { |
{ | ||
"name": "snapsave-media-downloader", | ||
"version": "1.0.7", | ||
"description": "Download Instagram and Facebook Media using snapsave.app downloader", | ||
"version": "1.1.0", | ||
"description": "Download Instagram, Facebook and TikTok media using snapsave.app downloader", | ||
"type": "module", | ||
@@ -9,2 +9,3 @@ "keywords": [ | ||
"facebook", | ||
"tiktok", | ||
"downloader", | ||
@@ -41,12 +42,14 @@ "media", | ||
"devDependencies": { | ||
"@stylistic/eslint-plugin": "^2.7.2", | ||
"@types/node": "^22.5.4", | ||
"@typescript-eslint/parser": "^8.4.0", | ||
"changelogen": "^0.5.5", | ||
"cheerio": "1.0.0", | ||
"eslint": "^9.9.1", | ||
"@stylistic/eslint-plugin": "^2.8.0", | ||
"@types/node": "^22.7.2", | ||
"@typescript-eslint/parser": "^8.7.0", | ||
"changelogen": "^0.5.7", | ||
"eslint": "^9.11.1", | ||
"shx": "^0.3.4", | ||
"tsup": "^8.2.4", | ||
"typescript": "^5.5.4" | ||
"tsup": "^8.3.0", | ||
"typescript": "^5.6.2" | ||
}, | ||
"dependencies": { | ||
"cheerio": "^1.0.0" | ||
}, | ||
"scripts": { | ||
@@ -53,0 +56,0 @@ "lint": "eslint . --fix", |
# Snapsave Media Downloader | ||
Download Instagram and Facebook Media using snapsave.app downloader | ||
Download Instagram, Facebook and TikTok media using snapsave.app downloader | ||
## Install dependency | ||
```bash | ||
# Using npm | ||
npm install snapsave-media-downloader | ||
# Using pnpm | ||
pnpm add snapsave-media-downloader | ||
``` | ||
Example: | ||
@@ -6,0 +15,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9181
8
149
33
1
+ Addedcheerio@^1.0.0
+ Addedboolbase@1.0.0(transitive)
+ Addedcheerio@1.0.0(transitive)
+ Addedcheerio-select@2.1.0(transitive)
+ Addedcss-select@5.1.0(transitive)
+ Addedcss-what@6.1.0(transitive)
+ Addeddom-serializer@2.0.0(transitive)
+ Addeddomelementtype@2.3.0(transitive)
+ Addeddomhandler@5.0.3(transitive)
+ Addeddomutils@3.1.0(transitive)
+ Addedencoding-sniffer@0.2.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedhtmlparser2@9.1.0(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addednth-check@2.1.1(transitive)
+ Addedparse5@7.2.1(transitive)
+ Addedparse5-htmlparser2-tree-adapter@7.1.0(transitive)
+ Addedparse5-parser-stream@7.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedundici@6.21.0(transitive)
+ Addedwhatwg-encoding@3.1.1(transitive)
+ Addedwhatwg-mimetype@4.0.0(transitive)