snapsave-media-downloader
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,2 +0,1 @@ | ||
declare const snapsave: (url: string) => Promise<SnapSaveDownloaderResponse>; | ||
interface SnapSaveDownloaderMedia { | ||
@@ -17,2 +16,4 @@ resolution?: string; | ||
declare const snapsave: (url: string) => Promise<SnapSaveDownloaderResponse>; | ||
export { snapsave }; |
@@ -43,2 +43,12 @@ var __defProp = Object.defineProperty; | ||
import { load } from "cheerio"; | ||
// src/utils.ts | ||
var facebookRegex = /^https?:\/\/(?:www\.|web\.|m\.)?facebook\.com\/(watch(\?v=|\/\?v=)[0-9]+(?!\/)|reel\/[0-9]+|[a-zA-Z0-9.\-_]+\/(videos|posts)\/[0-9]+|[0-9]+\/(videos|posts)\/[0-9]+|[a-zA-Z0-9]+\/(videos|posts)\/[0-9]+|share\/(v|r)\/[a-zA-Z0-9]+\/?)([^/?#&]+).*$|^https:\/\/fb\.watch\/[a-zA-Z0-9]+$/g; | ||
var instagramRegex = /^https?:\/\/(?:www\.)?instagram\.com\/(?:p|reel|reels|tv|stories)\/([^/?#&]+).*/g; | ||
var tiktokRegex = /^https?:\/\/(?:www\.|m\.|vm\.)?tiktok\.com\/(?:@[^/]+\/video\/\d+|v\/\d+|t\/[\w]+|[\w]+)\/?/g; | ||
var normalizeURL = (url) => { | ||
return /^(https?:\/\/)(?!www\.)[a-z0-9]+/i.test(url) ? url.replace(/^(https?:\/\/)([^./]+\.[^./]+)(\/.*)?$/, "$1www.$2$3") : url; | ||
}; | ||
// src/index.ts | ||
var snapsave = (url) => __async(void 0, null, function* () { | ||
@@ -86,9 +96,6 @@ try { | ||
}; | ||
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 { success: false, message: "Invalid URL" }; | ||
const formData = new URLSearchParams(); | ||
formData.append("url", /^(https?:\/\/)(?!www\.)[a-z0-9]+/i.test(url) ? url.replace(/^(https?:\/\/)([^./]+\.[^./]+)(\/.*)?$/, "$1www.$2$3") : url); | ||
formData.append("url", normalizeURL(url)); | ||
const response = yield fetch("https://snapsave.app/action.php?lang=en", { | ||
@@ -95,0 +102,0 @@ method: "POST", |
{ | ||
"name": "snapsave-media-downloader", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Download Instagram, Facebook and TikTok media using snapsave.app downloader", | ||
@@ -48,3 +48,4 @@ "type": "module", | ||
"tsup": "^8.3.5", | ||
"typescript": "^5.6.3" | ||
"typescript": "^5.6.3", | ||
"vitest": "^2.1.5" | ||
}, | ||
@@ -55,7 +56,9 @@ "dependencies": { | ||
"scripts": { | ||
"lint": "eslint . --fix", | ||
"lint": "eslint .", | ||
"build": "shx rm -rf ./dist/* && tsup-node src/index.ts --format esm --dts --config tsconfig.json", | ||
"playground": "node playground/index.js", | ||
"release": "changelogen --release" | ||
"release": "changelogen --release", | ||
"test": "vitest run --reporter=verbose", | ||
"test:types": "tsc --noEmit" | ||
} | ||
} |
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
16734
178
9