Version 1.4.1-rc1 - Attente de correctif

This commit is contained in:
2025-12-07 10:48:52 +01:00
parent fa869a11bf
commit 9544ee51f8

View File

@@ -61,38 +61,37 @@ async function getStream(song, seekTime = 0) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
clog.log(`[YT-DLP] Lancement pour : ${song.url} (Début: ${seekTime}s)`); clog.log(`[YT-DLP] Lancement pour : ${song.url} (Début: ${seekTime}s)`);
const ytArgs = [ const ytArgs = [
song.url, song.url,
'-o', '-', '-o', '-',
'-f', 'bestaudio[ext=webm]/bestaudio[ext=m4a]/bestaudio',
// NETWORKS // Sélecteur large : Audio pur OU Vidéo (ffmpeg se débrouillera)
'--force-ipv4', // INDISPENSABLE : Force la connexion via IPv4 (plus stable pour le streaming) '-f', 'bestaudio/best',
'--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', // Masque yt-dlp
// IMPORTANT : On se fait passer pour Edge (Windows) pour correspondre aux cookies
'--user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
'--force-ipv4',
'--no-warnings', '--no-warnings',
// --- GESTION DE LA RAM & FICHIERS --- '--no-part',
'--no-part', // Ne pas créer de fichiers .part '--no-keep-fragments',
'--no-keep-fragments', // Supprimer les fragments immédiatement (s'ils sont créés) '--buffer-size', '16K',
'--buffer-size', '16K', // Petit buffer pour forcer le flux continu (évite les pics d'écriture)
// --- OPTIONS DIVERS ---
'--no-check-certificate', '--no-check-certificate',
'--prefer-free-formats', '--ignore-config',
'--ignore-config' '--ignore-errors'
]; ];
// --- GESTION DU TIMECODE (SEEK) --- // --- GESTION DU TIMECODE (SEEK) ---
if (seekTime && seekTime > 0) { if (seekTime && seekTime > 0) {
// --begin accepte un format "10s", "1m30s" ou juste des secondes.
// C'est la méthode la plus fiable pour yt-dlp en streaming.
clog.log(`[YT-DLP] Positionnement à ${Math.round(seekTime)} secondes.`);
ytArgs.push('--download-sections', `*${Math.round(seekTime)}-inf`); ytArgs.push('--download-sections', `*${Math.round(seekTime)}-inf`);
} }
// --- GESTION DES COOKIES --- // // --- GESTION DES COOKIES ---
if (__glob.COOKIES) { // if (__glob.COOKIES) {
// clog.log(`[YT-DLP] Cookies chargés.`); // // Utiliser le format Netscape pour les cookies est impératif
ytArgs.push('--cookies', __glob.COOKIES); // ytArgs.push('--cookies', __glob.COOKIES);
ytArgs.push('--no-cache-dir'); // ytArgs.push('--no-cache-dir'); // Évite les conflits de cache avec les cookies
} // }
// Lancement du nouveau processus // Lancement du nouveau processus
const yt = spawn('yt-dlp', ytArgs); const yt = spawn('yt-dlp', ytArgs);