streamify-audio 2.0.2 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamify-audio",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Dual-mode audio library: HTTP streaming proxy + Discord player (Lavalink alternative). Supports YouTube, Spotify, SoundCloud with audio filters.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/config.js CHANGED
@@ -39,6 +39,23 @@ function findExecutable(name) {
39
39
  }
40
40
  }
41
41
 
42
+ const MIN_YTDLP_VERSION = '2026.01.19';
43
+
44
+ function checkYtdlpVersion(ytdlpPath) {
45
+ try {
46
+ const version = execSync(`"${ytdlpPath}" --version`, { encoding: 'utf-8' }).trim();
47
+ const versionDate = version.split('.').slice(0, 3).join('.');
48
+
49
+ if (versionDate < MIN_YTDLP_VERSION) {
50
+ console.warn(`[CONFIG] ⚠️ yt-dlp version ${version} is outdated`);
51
+ console.warn(`[CONFIG] ⚠️ Live YouTube streams require yt-dlp >= ${MIN_YTDLP_VERSION}`);
52
+ console.warn(`[CONFIG] ⚠️ Update with: yt-dlp --update-to nightly`);
53
+ }
54
+ } catch (e) {
55
+ console.warn('[CONFIG] Could not check yt-dlp version:', e.message);
56
+ }
57
+ }
58
+
42
59
  function load(options = {}) {
43
60
  let fileConfig = {};
44
61
 
@@ -123,6 +140,8 @@ function load(options = {}) {
123
140
  throw new Error('ffmpeg not found. Install it: apt install ffmpeg');
124
141
  }
125
142
 
143
+ checkYtdlpVersion(config.ytdlpPath);
144
+
126
145
  return config;
127
146
  }
128
147
 
@@ -198,6 +198,11 @@ class Manager extends EventEmitter {
198
198
  }
199
199
 
200
200
  async search(query, options = {}) {
201
+ const isUrl = query.startsWith('http://') || query.startsWith('https://');
202
+ if (isUrl) {
203
+ return this.resolve(query);
204
+ }
205
+
201
206
  const source = options.source || this._detectSource(query) || 'youtube';
202
207
  const limit = options.limit || 10;
203
208
 
@@ -313,6 +318,10 @@ class Manager extends EventEmitter {
313
318
  }
314
319
  }
315
320
 
321
+ const isUrl = query.startsWith('http://') || query.startsWith('https://');
322
+ if (isUrl) {
323
+ return { loadType: 'empty', tracks: [] };
324
+ }
316
325
  return this.search(query);
317
326
  }
318
327
 
@@ -332,7 +341,8 @@ class Manager extends EventEmitter {
332
341
  youtube: [
333
342
  /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,
334
343
  /(?:youtube\.com\/shorts\/)([a-zA-Z0-9_-]{11})/,
335
- /(?:music\.youtube\.com\/watch\?v=)([a-zA-Z0-9_-]{11})/
344
+ /(?:music\.youtube\.com\/watch\?v=)([a-zA-Z0-9_-]{11})/,
345
+ /(?:youtube\.com\/live\/)([a-zA-Z0-9_-]{11})/
336
346
  ],
337
347
  spotify: [
338
348
  /open\.spotify\.com\/track\/([a-zA-Z0-9]+)/,
@@ -357,7 +367,7 @@ class Manager extends EventEmitter {
357
367
 
358
368
  _extractId(input, source) {
359
369
  const patterns = {
360
- youtube: /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|music\.youtube\.com\/watch\?v=)([a-zA-Z0-9_-]{11})/,
370
+ youtube: /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/shorts\/|music\.youtube\.com\/watch\?v=|youtube\.com\/live\/)([a-zA-Z0-9_-]{11})/,
361
371
  youtube_playlist: /youtube\.com\/playlist\?list=([a-zA-Z0-9_-]+)/,
362
372
  spotify: /(?:open\.spotify\.com\/track\/|spotify:track:)([a-zA-Z0-9]+)/,
363
373
  spotify_playlist: /open\.spotify\.com\/playlist\/([a-zA-Z0-9]+)/,
@@ -51,7 +51,7 @@ class StreamController {
51
51
 
52
52
  let formatString;
53
53
  if (isLive) {
54
- formatString = 'bestaudio[ext=webm]/bestaudio/best';
54
+ formatString = 'bestaudio*/best';
55
55
  } else {
56
56
  formatString = isYouTube ? '18/22/bestaudio[ext=webm]/bestaudio/best' : 'bestaudio/best';
57
57
  }
@@ -68,11 +68,9 @@ class StreamController {
68
68
  ];
69
69
 
70
70
  if (isLive) {
71
- ytdlpArgs.push('--live-from-start');
71
+ ytdlpArgs.push('--no-live-from-start');
72
72
  log.info('STREAM', `Live stream detected, using live-compatible format`);
73
- }
74
-
75
- if (isYouTube) {
73
+ } else if (isYouTube) {
76
74
  ytdlpArgs.push('--extractor-args', 'youtube:player_client=web_creator');
77
75
  }
78
76