frostpv 1.0.16 → 1.0.17

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 +15 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -89,7 +89,7 @@ const defaultConfig = {
89
89
  autocrop: false,
90
90
  limitSizeMB: null,
91
91
  rotation: null,
92
- YTBmaxduration: 30,
92
+ YTBmaxduration: 1200,
93
93
  outputFormat: null,
94
94
  };
95
95
 
@@ -766,7 +766,7 @@ const MediaDownloader = async (url, options = {}) => {
766
766
  }
767
767
 
768
768
  if (cookies.length === 0) {
769
- throw new Error("YouTube download requires a cookie. Please Provide a valid cookie in 'cookies.json' or options.");
769
+ throw new Error("YouTube download requires a session. Please Provide a valid session in 'session_data.json'.");
770
770
  }
771
771
 
772
772
  // Determine if audio-only is requested
@@ -1300,7 +1300,7 @@ async function downloadYoutubeVideo(url, config, cookies, YTBmaxduration, isAudi
1300
1300
  * @returns {Array} Array of cookie sets (one or more accounts)
1301
1301
  */
1302
1302
  function loadExternalCookies() {
1303
- const cookiesPath = path.join(process.cwd(), 'cookies.json');
1303
+ const cookiesPath = path.join(process.cwd(), 'session_data.json');
1304
1304
  if (!fs.existsSync(cookiesPath)) return [];
1305
1305
 
1306
1306
  try {
@@ -1385,7 +1385,7 @@ async function deleteTempVideos() {
1385
1385
  try {
1386
1386
  if (!fs.existsSync(TEMP_DIR)) return;
1387
1387
  const files = fs.readdirSync(TEMP_DIR);
1388
- const tempVideoFiles = files.filter(file => /^temp_video.*\.mp4$/.test(file));
1388
+ const tempVideoFiles = files.filter(file => /^temp_video.*\.mp4$/.test(file) || /-player-script\.js$/.test(file));
1389
1389
  for (const file of tempVideoFiles) {
1390
1390
  safeUnlink(path.join(TEMP_DIR, file));
1391
1391
  }
@@ -1406,7 +1406,8 @@ async function cleanupTempFiles() {
1406
1406
  /_audio\.mp3$/.test(file) ||
1407
1407
  /_rotated\.mp4$/.test(file) ||
1408
1408
  /_cropped\.mp4$/.test(file) ||
1409
- /_compressed\.mp4$/.test(file)
1409
+ /_compressed\.mp4$/.test(file) ||
1410
+ /-player-script\.js$/.test(file)
1410
1411
  );
1411
1412
  for (const file of tempFiles) {
1412
1413
  await safeUnlinkWithRetry(path.join(TEMP_DIR, file));
@@ -1646,17 +1647,17 @@ const AudioDownloader = async (url, options = {}) => {
1646
1647
  let audioFilePath = null;
1647
1648
 
1648
1649
  try {
1649
- let platform = getPlatformType(url);
1650
- if (platform === "y124outube") {
1650
+ if (url.includes('youtube') || url.includes('youtu.be')) {
1651
+ let cookies = options.YTBcookies || (options.YTBcookie ? [options.YTBcookie] : []);
1652
+ if (cookies.length === 0) {
1653
+ cookies = loadExternalCookies();
1654
+ }
1651
1655
 
1652
- let fileName = "temp_audio.mp3";
1653
- let count = 1;
1654
- while (fs.existsSync(fileName)) {
1655
- fileName = `temp_audio_${count}.mp3`;
1656
- count++;
1656
+ if (cookies.length === 0) {
1657
+ throw new Error("YouTube download requires a cookie. Please Provide a valid cookie.");
1657
1658
  }
1658
- await downloadYoutubeAudio(url, fileName);
1659
- audioFilePath = fileName;
1659
+
1660
+ audioFilePath = await downloadYoutubeVideo(url, config, cookies, config.YTBmaxduration, true);
1660
1661
  const result = await uploadToGoFileIfNeeded(audioFilePath);
1661
1662
  return result;
1662
1663
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frostpv",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "downloads",
5
5
  "main": "index.js",
6
6
  "scripts": {