streamify-audio 2.3.0 → 2.3.1
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/index.d.ts +9 -0
- package/package.json +1 -1
- package/src/config.js +11 -0
- package/src/discord/Manager.js +1 -1
- package/src/discord/Stream.js +9 -12
- package/src/providers/spotify.js +2 -2
- package/youtube-cookies.txt +5 -5
package/index.d.ts
CHANGED
|
@@ -203,6 +203,15 @@ declare module 'streamify-audio' {
|
|
|
203
203
|
enabled?: boolean;
|
|
204
204
|
maxTracks?: number;
|
|
205
205
|
};
|
|
206
|
+
stream?: {
|
|
207
|
+
dataTimeout?: number;
|
|
208
|
+
pipeDataTimeout?: number;
|
|
209
|
+
liveDataTimeout?: number;
|
|
210
|
+
extractTimeout?: number;
|
|
211
|
+
urlCacheTTL?: number;
|
|
212
|
+
bufferSize?: string;
|
|
213
|
+
maxRetries?: number;
|
|
214
|
+
};
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
export interface ManagerStats {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "streamify-audio",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
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
|
@@ -41,10 +41,16 @@ const defaults = {
|
|
|
41
41
|
},
|
|
42
42
|
stream: {
|
|
43
43
|
dataTimeout: 8000,
|
|
44
|
+
pipeDataTimeout: 20000,
|
|
44
45
|
liveDataTimeout: 15000,
|
|
46
|
+
extractTimeout: 30000,
|
|
45
47
|
urlCacheTTL: 1800,
|
|
46
48
|
bufferSize: '1M',
|
|
47
49
|
maxRetries: 2
|
|
50
|
+
},
|
|
51
|
+
sponsorblock: {
|
|
52
|
+
enabled: false,
|
|
53
|
+
categories: ['sponsor', 'selfpromo']
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
56
|
|
|
@@ -119,6 +125,11 @@ function load(options = {}) {
|
|
|
119
125
|
...defaults.stream,
|
|
120
126
|
...fileConfig.stream,
|
|
121
127
|
...options.stream
|
|
128
|
+
},
|
|
129
|
+
sponsorblock: {
|
|
130
|
+
...defaults.sponsorblock,
|
|
131
|
+
...fileConfig.sponsorblock,
|
|
132
|
+
...options.sponsorblock
|
|
122
133
|
}
|
|
123
134
|
};
|
|
124
135
|
|
package/src/discord/Manager.js
CHANGED
|
@@ -403,7 +403,7 @@ class Manager extends EventEmitter {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
async _resolveSpotifyToYouTube(track) {
|
|
406
|
-
const videoId = await spotify.resolveToYouTube(track.id, this.config);
|
|
406
|
+
const videoId = await spotify.resolveToYouTube(track.id, this.config, track);
|
|
407
407
|
return videoId;
|
|
408
408
|
}
|
|
409
409
|
|
package/src/discord/Stream.js
CHANGED
|
@@ -95,7 +95,7 @@ class StreamController {
|
|
|
95
95
|
log.info('STREAM', `Resolving Spotify track to YouTube: ${this.track.title}`);
|
|
96
96
|
try {
|
|
97
97
|
const spotify = require('../providers/spotify');
|
|
98
|
-
videoId = await spotify.resolveToYouTube(this.track.id, this.config);
|
|
98
|
+
videoId = await spotify.resolveToYouTube(this.track.id, this.config, this.track);
|
|
99
99
|
this.track._resolvedId = videoId;
|
|
100
100
|
this.metrics.metadata = Date.now() - this.startTime;
|
|
101
101
|
} catch (error) {
|
|
@@ -238,7 +238,7 @@ class StreamController {
|
|
|
238
238
|
ytdlpArgs.unshift('--cookies', this.config.cookiesPath);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
if (this.config.sponsorblock?.enabled
|
|
241
|
+
if (this.config.sponsorblock?.enabled === true && isYouTube) {
|
|
242
242
|
const categories = this.config.sponsorblock?.categories || ['sponsor', 'selfpromo'];
|
|
243
243
|
ytdlpArgs.push('--sponsorblock-remove', categories.join(','));
|
|
244
244
|
}
|
|
@@ -365,11 +365,9 @@ class StreamController {
|
|
|
365
365
|
const url = `https://www.youtube.com/watch?v=${videoId}`;
|
|
366
366
|
const args = [
|
|
367
367
|
'--get-url',
|
|
368
|
-
'-f',
|
|
368
|
+
'-f', 'bestaudio/best',
|
|
369
369
|
'--no-playlist',
|
|
370
|
-
'--no-check-certificates',
|
|
371
370
|
'--no-warnings',
|
|
372
|
-
'--no-cache-dir',
|
|
373
371
|
url
|
|
374
372
|
];
|
|
375
373
|
|
|
@@ -381,20 +379,16 @@ class StreamController {
|
|
|
381
379
|
args.unshift('--cookies', config.cookiesPath);
|
|
382
380
|
}
|
|
383
381
|
|
|
384
|
-
if (config.sponsorblock?.enabled !== false && isYouTube) {
|
|
385
|
-
const categories = config.sponsorblock?.categories || ['sponsor', 'selfpromo'];
|
|
386
|
-
args.push('--sponsorblock-remove', categories.join(','));
|
|
387
|
-
}
|
|
388
|
-
|
|
389
382
|
const env = { ...process.env, PATH: '/usr/local/bin:/root/.deno/bin:' + process.env.PATH };
|
|
390
383
|
const proc = spawn(config.ytdlpPath, args, { env });
|
|
391
384
|
|
|
392
385
|
let stdout = '';
|
|
393
386
|
let stderr = '';
|
|
387
|
+
const extractTimeout = config.stream?.extractTimeout || 30000;
|
|
394
388
|
const timeout = setTimeout(() => {
|
|
395
389
|
proc.kill('SIGKILL');
|
|
396
390
|
reject(new Error('URL extraction timed out'));
|
|
397
|
-
},
|
|
391
|
+
}, extractTimeout);
|
|
398
392
|
|
|
399
393
|
proc.stdout.on('data', (data) => { stdout += data; });
|
|
400
394
|
proc.stderr.on('data', (data) => { stderr += data; });
|
|
@@ -422,9 +416,12 @@ class StreamController {
|
|
|
422
416
|
const ffmpeg = this.ffmpeg;
|
|
423
417
|
const ytdlp = this.ytdlp;
|
|
424
418
|
const isLive = this.track.isLive === true || this.track.duration === 0;
|
|
419
|
+
const isPipe = !!this.ytdlp;
|
|
425
420
|
const timeoutMs = isLive
|
|
426
421
|
? (this.config.stream?.liveDataTimeout || 15000)
|
|
427
|
-
:
|
|
422
|
+
: isPipe
|
|
423
|
+
? (this.config.stream?.pipeDataTimeout || 20000)
|
|
424
|
+
: (this.config.stream?.dataTimeout || 8000);
|
|
428
425
|
|
|
429
426
|
return new Promise((resolve, reject) => {
|
|
430
427
|
if (!ffmpeg) return resolve();
|
package/src/providers/spotify.js
CHANGED
|
@@ -104,14 +104,14 @@ async function getInfo(trackId, config) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async function resolveToYouTube(trackId, config) {
|
|
107
|
+
async function resolveToYouTube(trackId, config, trackInfo = null) {
|
|
108
108
|
const cached = youtubeIdCache.get(trackId);
|
|
109
109
|
if (cached && Date.now() < cached.expires) {
|
|
110
110
|
log.info('SPOTIFY', `Using cached YouTube ID: ${cached.videoId}`);
|
|
111
111
|
return cached.videoId;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const track = await getInfo(trackId, config);
|
|
114
|
+
const track = trackInfo || await getInfo(trackId, config);
|
|
115
115
|
const searchQuery = `${track.author} - ${track.title}`;
|
|
116
116
|
log.info('SPOTIFY', `Searching YouTube: "${searchQuery}"`);
|
|
117
117
|
|
package/youtube-cookies.txt
CHANGED
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
.youtube.com TRUE / TRUE 1803850170 __Secure-1PSID g.a0006AhyolP4RoeyrQXcHsFnRGkuVLVIZ9QQsgpwFaXGd822GTtb9khH10B1YSjuMht-R8LNjAACgYKAQ8SARMSFQHGX2MiWX5D8_L5MAZK1TLabPQMghoVAUF8yKoFUiQLoi8zHLuskryhcx1P0076
|
|
17
17
|
.youtube.com TRUE / TRUE 1803850170 __Secure-3PSID g.a0006AhyolP4RoeyrQXcHsFnRGkuVLVIZ9QQsgpwFaXGd822GTtbc5VtVrqvDy9fWzO4vguctgACgYKAUkSARMSFQHGX2MinKYgh3CtvTW5E5T8SwXiERoVAUF8yKqzIJTS4ajNX5uO8nh3r0j10076
|
|
18
18
|
.youtube.com TRUE / TRUE 1803850170 LOGIN_INFO AFmmF2swRQIgH6IrdLYFOhW8xu4opIUHTGxAf33LzI5EXw6pdoqsh_gCIQCxYHQL4VZEyb3nE-rhXM6VU2ua99G4AhzKl4JJlzZBEQ:QUQ3MjNmeFpJOS1rVDgtM2I4cm50Z3M4NUplLTlSbXV4OFl4MTM5eUtHX3FEcVNmT2ltVFlSWmpQdlR2QTVqR29mZlUtTVh4OEhkOGw4Rkd5d2tQZm52NXJmQzdrMFJPVk5uYTFLNFFMZWlGelJhRVk1TkVaMm9Uby0xWlcwR3ozYkwwY2lWT21pV2dpU0lsWW5saFhMektISWxwUkRUcXl3
|
|
19
|
-
.youtube.com TRUE / FALSE
|
|
20
|
-
.youtube.com TRUE / TRUE
|
|
21
|
-
.youtube.com TRUE / TRUE
|
|
19
|
+
.youtube.com TRUE / FALSE 1803305829 SIDCC AKEyXzVSEL6KtSGHvInzUQ0BSfXpz5ZrLa-0C-Eai37AQJIjMlJt1w_sEekg2V8xFZDAAGxTWAw
|
|
20
|
+
.youtube.com TRUE / TRUE 1803305829 __Secure-1PSIDCC AKEyXzXpSwFxdQf2HR6oN-bhlMdxFzAE_V_Yj8xI1esygZBBs74ztRf0QOQkFC9uwI136LDjIA
|
|
21
|
+
.youtube.com TRUE / TRUE 1803305829 __Secure-3PSIDCC AKEyXzUPIscYupkn1WfA8pYnKB611cDvKT0mlN3DFM6aP68r90lpGrwcI3cggeJuvS__Yir28g
|
|
22
22
|
.youtube.com TRUE / TRUE 1787290794 __Secure-YNID 16.YT=uhIB3j65_j5F-nN_AIVu93J6J4tqe4fviGdBQuGk0X5EW7VRESfm4qMadhbgM04D7x1YyYRXKI0UIHJjiRMWqsP5PmT_qrHoTUSn4MOLA-FPeX09ELODYdpGvps9F6B3EFC2jC4MXYiWVY6KGZRiEoYBh_KWkh4Suwgn38LgfqN0E4Xv3YAzCB390qeKtLVkaqlQDUIvhnqGBPrObW-DzawPn00gHQph8VM2Zrklq_BzRYVaZHKHs2WkKlHqLljxwOiNXcsLrIkLqGsCgKR_onVOnlWN2gd0zojNv0VyuwYgfB9GBOLzweTnTWBZmp9IPWRA39DH4zMFerdTND-Yfg
|
|
23
23
|
.youtube.com TRUE / TRUE 0 YSC -LHUdUOZvC4
|
|
24
|
-
.youtube.com TRUE / TRUE
|
|
25
|
-
.youtube.com TRUE / TRUE
|
|
24
|
+
.youtube.com TRUE / TRUE 1787321829 VISITOR_INFO1_LIVE AuEVGsoJz2Y
|
|
25
|
+
.youtube.com TRUE / TRUE 1787321829 VISITOR_PRIVACY_METADATA CgJVUxIEGgAgVQ%3D%3D
|
|
26
26
|
.youtube.com TRUE / TRUE 1787290794 __Secure-ROLLOUT_TOKEN CIbdoKq8kOipXhC__cjij6WSAxiZi8-rseySAw%3D%3D
|