frostpv 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +12 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -72,6 +72,12 @@ const linkCant = [{
|
|
|
72
72
|
|
|
73
73
|
// Function to check if a link corresponds to a video platform
|
|
74
74
|
const isVideoLink = (link) => {
|
|
75
|
+
try {
|
|
76
|
+
const u = new URL(link);
|
|
77
|
+
const host = (u.hostname || '').toLowerCase();
|
|
78
|
+
// Allow localized Pinterest subdomains (e.g., br.pinterest.com, en.pinterest.com)
|
|
79
|
+
if (host.endsWith('pinterest.com')) return true;
|
|
80
|
+
} catch (_) {}
|
|
75
81
|
return videoPlatforms.some(platform => link.startsWith(platform));
|
|
76
82
|
};
|
|
77
83
|
|
|
@@ -1042,7 +1048,7 @@ async function downloadSmartVideo(url, config) {
|
|
|
1042
1048
|
if (!directUrl) throw new Error("No media URL found in Pinterest response");
|
|
1043
1049
|
|
|
1044
1050
|
// HEAD validate
|
|
1045
|
-
const head = await axios.head(directUrl, { timeout: 10000 }).catch(() => null);
|
|
1051
|
+
const head = await axios.head(directUrl, { timeout: 10000, maxRedirects: 5 }).catch(() => null);
|
|
1046
1052
|
if (!head || (head.status < 200 || head.status >= 400)) {
|
|
1047
1053
|
throw new Error("Pinterest media URL not accessible");
|
|
1048
1054
|
}
|
|
@@ -1459,8 +1465,11 @@ function getFileName(url) {
|
|
|
1459
1465
|
// Function to unshorten URLs
|
|
1460
1466
|
async function unshortenUrl(url) {
|
|
1461
1467
|
try {
|
|
1462
|
-
// Special handling for Facebook
|
|
1463
|
-
if (
|
|
1468
|
+
// Special handling for Facebook and Pinterest short-links
|
|
1469
|
+
if (
|
|
1470
|
+
url.includes('facebook.com') || url.includes('fb.watch') || url.includes('fb.com') ||
|
|
1471
|
+
url.includes('pin.it') || url.includes('pinterest.com')
|
|
1472
|
+
) {
|
|
1464
1473
|
const response = await axios.get(url, {
|
|
1465
1474
|
maxRedirects: 10,
|
|
1466
1475
|
timeout: 10000,
|