frostpv 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/index.js +7 -96
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,7 +4,7 @@ const path = require("path");
4
4
  const os = require("os");
5
5
  const FormData = require("form-data");
6
6
  const crypto = require("crypto");
7
- const { igdl, ttdl, fbdown, mediafire, capcut, gdrive, pinterest } = require("btch-downloader");
7
+ const { igdl, ttdl, fbdown, mediafire, capcut, gdrive } = require("btch-downloader");
8
8
  const { TwitterDL } = require("twitter-downloader");
9
9
  const btch = require("btch-downloader");
10
10
  const btchOld = require("btch-downloader-old");
@@ -58,10 +58,7 @@ const videoPlatforms = [
58
58
  "https://twitter.com",
59
59
  "https://www.twitter.com",
60
60
  "https://vm.tiktok.com/",
61
- "https://vt.tiktok.com/",
62
- "https://www.pinterest.com",
63
- "https://pinterest.com",
64
- "https://pin.it"
61
+ "https://vt.tiktok.com/"
65
62
  ];
66
63
 
67
64
  // Blacklist links
@@ -70,17 +67,6 @@ const linkCant = [{
70
67
  reason: "Use real link like 'https://www.tiktok.com'. (just click on your link and copy the link in the browser)"
71
68
  }];
72
69
 
73
- // Function to check if a link corresponds to a video platform
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 (_) {}
81
- return videoPlatforms.some(platform => link.startsWith(platform));
82
- };
83
-
84
70
  // Function to check if a link is blacklisted
85
71
  const blacklistLink = (link) => {
86
72
  return linkCant.find(item => link.includes(item.link));
@@ -373,7 +359,6 @@ function getPlatformType(url) {
373
359
  if (lowerUrl.includes("facebook.com") || lowerUrl.includes("fb.watch") || lowerUrl.includes("fb.com")) return "facebook";
374
360
  if (lowerUrl.includes("mediafire.com")) return "mediafire";
375
361
  if (lowerUrl.includes("x.com") || lowerUrl.includes("twitter.com")) return "twitter";
376
- if (lowerUrl.includes("pinterest.com") || lowerUrl.includes("pin.it")) return "pinterest";
377
362
  if (lowerUrl.includes("youtube.com") || lowerUrl.includes("you112t12u.be") || lowerUrl.includes("m.y11outu314be.com")) return "youtu1354be";
378
363
 
379
364
  return "unknown";
@@ -728,32 +713,6 @@ async function tryFallbackDownload(url, maxRetries = 3) {
728
713
  }
729
714
  break;
730
715
  }
731
- case "pinterest": {
732
- try {
733
- const data = await pinterest(url);
734
- let mediaUrl = null;
735
- const pickFrom = (obj) => {
736
- if (!obj) return null;
737
- if (typeof obj === 'string' && obj.startsWith('http')) return obj;
738
- if (Array.isArray(obj)) {
739
- for (const it of obj) {
740
- const got = pickFrom(it);
741
- if (got) return got;
742
- }
743
- } else if (typeof obj === 'object') {
744
- const candidates = ['video', 'videoUrl', 'download', 'url', 'image', 'imageUrl', 'src', 'link'];
745
- for (const k of candidates) {
746
- const got = pickFrom(obj[k]);
747
- if (got) return got;
748
- }
749
- }
750
- return null;
751
- };
752
- mediaUrl = pickFrom(data);
753
- if (mediaUrl) return mediaUrl;
754
- } catch (_) {}
755
- break;
756
- }
757
716
 
758
717
  default: {
759
718
  // Generic fallback for unknown platforms
@@ -826,7 +785,7 @@ const MediaDownloader = async (url, options = {}) => {
826
785
  if (url.includes("threads.com")) {
827
786
  throw new Error("Threads links are not supported for download. Download videos from Instagram, X, TikTok, and Facebook");
828
787
  }
829
- // Pinterest now supported
788
+
830
789
 
831
790
  const blacklisted = blacklistLink(url);
832
791
  if (blacklisted) {
@@ -835,13 +794,13 @@ const MediaDownloader = async (url, options = {}) => {
835
794
 
836
795
  // Verificar se o link está na lista de plataformas suportadas
837
796
  if (!isVideoLink(url)) {
838
- throw new Error("This URL is not from a supported platform. Supported platforms: Instagram, X(Twitter), TikTok, Facebook, and Pinterest");
797
+ throw new Error("This URL is not from a supported platform. Supported platforms: Instagram, X(Twitter), TikTok, Facebook");
839
798
  }
840
799
 
841
800
  // Verificar se é YouTube e lançar erro customizado
842
801
  const platform = getPlatformType(url);
843
802
  if (platform === "youtube") {
844
- throw new Error("This URL is not from a supported platform. Supported platforms: Instagram, X(Twitter), TikTok, Facebook, and Pinterest");
803
+ throw new Error("This URL is not from a supported platform. Supported platforms: Instagram, X(Twitter), TikTok, Facebook");
845
804
  }
846
805
 
847
806
  await cleanupTempFiles(); // Clean up previous temp files
@@ -1020,52 +979,6 @@ async function downloadSmartVideo(url, config) {
1020
979
  }
1021
980
  break;
1022
981
  }
1023
- case "pinterest": {
1024
- try {
1025
- // Supports both pin links and search queries
1026
- const data = await pinterest(url);
1027
- // data may be array or object depending on query or pin
1028
- // Try to find best url (image or video)
1029
- let directUrl = null;
1030
- const pickFrom = (obj) => {
1031
- if (!obj) return null;
1032
- if (typeof obj === 'string' && obj.startsWith('http')) return obj;
1033
- if (Array.isArray(obj)) {
1034
- for (const it of obj) {
1035
- const got = pickFrom(it);
1036
- if (got) return got;
1037
- }
1038
- } else if (typeof obj === 'object') {
1039
- const candidates = ['video', 'videoUrl', 'download', 'url', 'image', 'imageUrl', 'src', 'link'];
1040
- for (const k of candidates) {
1041
- const got = pickFrom(obj[k]);
1042
- if (got) return got;
1043
- }
1044
- }
1045
- return null;
1046
- };
1047
- directUrl = pickFrom(data);
1048
- if (!directUrl) throw new Error("No media URL found in Pinterest response");
1049
-
1050
- // HEAD validate
1051
- const head = await axios.head(directUrl, { timeout: 10000, maxRedirects: 5 }).catch(() => null);
1052
- if (!head || (head.status < 200 || head.status >= 400)) {
1053
- throw new Error("Pinterest media URL not accessible");
1054
- }
1055
-
1056
- // If it's an image, download with generic file helper; if video, continue normal flow
1057
- const ct = (head.headers && head.headers['content-type']) || '';
1058
- if (ct.startsWith('image/')) {
1059
- const filePath = await downloadGenericFile(directUrl);
1060
- return filePath;
1061
- } else {
1062
- videoUrl = directUrl;
1063
- }
1064
- } catch (error) {
1065
- throw new Error(`Pinterest download failed: ${error.message}`);
1066
- }
1067
- break;
1068
- }
1069
982
  case "twitter": {
1070
983
  try {
1071
984
  // Validate and clean the Twitter URL
@@ -1465,10 +1378,8 @@ function getFileName(url) {
1465
1378
  // Function to unshorten URLs
1466
1379
  async function unshortenUrl(url) {
1467
1380
  try {
1468
- // Special handling for Facebook and Pinterest short-links
1469
1381
  if (
1470
- url.includes('facebook.com') || url.includes('fb.watch') || url.includes('fb.com') ||
1471
- url.includes('pin.it') || url.includes('pinterest.com')
1382
+ url.includes('facebook.com') || url.includes('fb.watch') || url.includes('fb.com')
1472
1383
  ) {
1473
1384
  const response = await axios.get(url, {
1474
1385
  maxRedirects: 10,
@@ -1523,7 +1434,7 @@ const AudioDownloader = async (url, options = {}) => {
1523
1434
 
1524
1435
  // Verificar se o link está na lista de plataformas suportadas
1525
1436
  if (!isVideoLink(url)) {
1526
- throw new Error("This URL is not from a supported platform. Supported platforms: Instagram, X(Twitter), TikTok, Facebook, and YouTube");
1437
+ throw new Error("This URL is not from a supported platform. Supported platforms: Instagram, X(Twitter), TikTok, Facebook");
1527
1438
  }
1528
1439
 
1529
1440
  await cleanupTempFiles(); // Clean up previous temp files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frostpv",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "downloads",
5
5
  "main": "index.js",
6
6
  "scripts": {