frostpv 1.0.17 → 1.0.18

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 +8 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1236,22 +1236,23 @@ async function downloadYoutubeVideo(url, config, cookies, YTBmaxduration, isAudi
1236
1236
  throw new Error('❌ No suitable audio format found.');
1237
1237
  }
1238
1238
  } else {
1239
+ // Filter for formats that have both audio and video (muxed)
1240
+ // We prioritize higher quality but limit to 1080p if possible
1239
1241
  let formats = info.formats.filter(format => {
1240
- return format.contentLength && parseInt(format.contentLength) <= 10 * 1024 * 1024 && // ≤ 10 MB
1241
- format.hasAudio && format.hasVideo;
1242
+ return format.hasAudio && format.hasVideo && (!format.height || format.height <= 1080);
1242
1243
  });
1243
1244
 
1244
1245
  if (formats.length === 0) {
1245
- formats = info.formats.filter(format => {
1246
- return format.hasAudio && format.hasVideo;
1247
- });
1246
+ // If no 1080p muxed formats, take any muxed format
1247
+ formats = info.formats.filter(format => format.hasAudio && format.hasVideo);
1248
1248
  }
1249
1249
 
1250
1250
  if (formats.length === 0) {
1251
- throw new Error('❌ No suitable video format found.');
1251
+ throw new Error('❌ No suitable video format found with both audio and video.');
1252
1252
  }
1253
1253
 
1254
- bestFormat = formats.sort((a, b) => b.height - a.height)[0];
1254
+ // Sort by resolution (height) descending to get best quality
1255
+ bestFormat = formats.sort((a, b) => (b.height || 0) - (a.height || 0))[0];
1255
1256
  }
1256
1257
 
1257
1258
  const ext = isAudioOnly ? 'mp3' : 'mp4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frostpv",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "downloads",
5
5
  "main": "index.js",
6
6
  "scripts": {