Compare commits

...

2 Commits

Author SHA1 Message Date
83e11f3341 Merge branch 'main' of https://git.raphix.fr/subsonics/chopin
All checks were successful
Deployment Pipeline / deploy (push) Successful in 35s
2025-08-29 12:26:32 +02:00
b132041d16 Version 1.1.2 - Modification User-Agent 2025-08-29 12:26:25 +02:00
3 changed files with 23 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "chopin-backend",
"version": "1.1.1",
"version": "1.1.2",
"description": "Discord Bot for music - Fetching everywhere !",
"main": "src/main.js",
"nodemonConfig": {

View File

@@ -4,6 +4,7 @@ const clog = new LogType("Youtube-Stream")
const ytdl = require('@distube/ytdl-core')
const ffmpeg = require('fluent-ffmpeg')
const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils");
const { __glob } = require('../../utils/GlobalVars');
async function getStream(song) {
@@ -194,14 +195,32 @@ async function getStream(song) {
]
ytdl.createAgent(cookies)
try {
const headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' +
'AppleWebKit/537.36 (KHTML, like Gecko) ' +
'Chrome/116.0.5845.97 Safari/537.36',
'Accept-Language': 'en-US,en;q=0.9'
};
// let cookies = null;
// try {
// cookies = JSON.parse(fs.readFileSync(__glob.COOKIES, 'utf-8'));
// } catch (error) {
// clog.error("Erreur lors de la lecture des cookies : " + error);
// }
// ytdl.createAgent({
// cookies
// });
let stream = ytdl(song.url, {
quality: 'highestaudio',
highWaterMark: 1 << 30,
liveBuffer: 20000,
dlChunkSize: 0,
bitrate: 128,
requestOptions: {
headers: headers,
}
});
return stream

View File

@@ -17,6 +17,7 @@ const __glob = {
MEDIA_DB: root + path.sep + "data" + path.sep + "media.json",
VERSION: version,
CHANGELOG_PATH: root + path.sep + "CHANGELOG.html",
COOKIES: root + path.sep + "data" + path.sep + "cookies.json"
}
module.exports = {__glob}