streamify-audio 2.0.3 → 2.0.5

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.3",
3
+ "version": "2.0.5",
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
 
@@ -34,9 +34,26 @@ class StreamController {
34
34
  }
35
35
 
36
36
  this.startTime = Date.now();
37
- const videoId = this.track._resolvedId || this.track.id;
38
37
  const source = this.track.source || 'youtube';
39
38
 
39
+ let videoId = this.track._resolvedId || this.track.id;
40
+
41
+ if (source === 'spotify' && !this.track._resolvedId) {
42
+ log.info('STREAM', `Resolving Spotify track to YouTube: ${this.track.title}`);
43
+ try {
44
+ const spotify = require('../providers/spotify');
45
+ videoId = await spotify.resolveToYouTube(this.track.id, this.config);
46
+ this.track._resolvedId = videoId;
47
+ } catch (error) {
48
+ log.error('STREAM', `Spotify resolution failed: ${error.message}`);
49
+ throw new Error(`Failed to resolve Spotify track: ${error.message}`);
50
+ }
51
+ }
52
+
53
+ if (!videoId || videoId === 'undefined') {
54
+ throw new Error(`Invalid track ID: ${videoId} (source: ${source}, title: ${this.track.title})`);
55
+ }
56
+
40
57
  log.info('STREAM', `Creating stream for ${videoId} (${source})`);
41
58
 
42
59
  let url;