social-dl 0.9.6 → 0.9.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-dl",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Direct CDN social downloader - YouTube, TikTok, Facebook, Instagram, Twitter, Pinterest, CapCut - No API, No keys, Never dies",
6
6
  "main": "src/index.js",
@@ -154,5 +154,10 @@ export async function tiktokSave(url, dest = './tt.mp4', quality = 'best', optio
154
154
  await writeFile(dest, output.buffer);
155
155
  return dest;
156
156
  }
157
- return saveResult(result, dest, quality, { Referer: 'https://www.tiktok.com/' });
157
+ try { return await saveResult(result, dest, quality, { Referer: 'https://www.tiktok.com/' }); }
158
+ catch {
159
+ const output = await tiktokDownload(url, dest.toLowerCase().endsWith('.mp3') ? 'mp3' : 'mp4', options);
160
+ await writeFile(dest, output.buffer);
161
+ return dest;
162
+ }
158
163
  }
@@ -82,7 +82,7 @@ export async function ytDlpDownloadUrl(url, format, options = {}) {
82
82
  const output = join(dir, `${base}.%(ext)s`);
83
83
  const args = format === 'mp3'
84
84
  ? [...BASE_ARGS, ...cookieArgs(options), '-f', 'bestaudio[ext=m4a]/bestaudio', '-x', '--audio-format', 'mp3', '--audio-quality', '0', '-o', output, url]
85
- : [...BASE_ARGS, ...cookieArgs(options), '-f', 'bv*[ext=mp4][vcodec^=avc1][height<=720]+ba[ext=m4a][acodec^=mp4a]/b[ext=mp4][height<=720]', '--merge-output-format', 'mp4', '--remux-video', 'mp4', '-o', output, url];
85
+ : [...BASE_ARGS, ...cookieArgs(options), '-f', 'bv*[ext=mp4][height<=1080]+ba[ext=m4a]/b[ext=mp4]/best', '--merge-output-format', 'mp4', '--remux-video', 'mp4', '-o', output, url];
86
86
  let file;
87
87
  try {
88
88
  await runYtDlp(args);