Compare commits
2 Commits
33da8e8527
...
83e11f3341
Author | SHA1 | Date | |
---|---|---|---|
83e11f3341
|
|||
b132041d16
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chopin-backend",
|
"name": "chopin-backend",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "Discord Bot for music - Fetching everywhere !",
|
"description": "Discord Bot for music - Fetching everywhere !",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
@@ -4,6 +4,7 @@ const clog = new LogType("Youtube-Stream")
|
|||||||
const ytdl = require('@distube/ytdl-core')
|
const ytdl = require('@distube/ytdl-core')
|
||||||
const ffmpeg = require('fluent-ffmpeg')
|
const ffmpeg = require('fluent-ffmpeg')
|
||||||
const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils");
|
const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils");
|
||||||
|
const { __glob } = require('../../utils/GlobalVars');
|
||||||
|
|
||||||
async function getStream(song) {
|
async function getStream(song) {
|
||||||
|
|
||||||
@@ -194,14 +195,32 @@ async function getStream(song) {
|
|||||||
]
|
]
|
||||||
ytdl.createAgent(cookies)
|
ytdl.createAgent(cookies)
|
||||||
try {
|
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, {
|
let stream = ytdl(song.url, {
|
||||||
quality: 'highestaudio',
|
quality: 'highestaudio',
|
||||||
highWaterMark: 1 << 30,
|
highWaterMark: 1 << 30,
|
||||||
liveBuffer: 20000,
|
liveBuffer: 20000,
|
||||||
dlChunkSize: 0,
|
dlChunkSize: 0,
|
||||||
bitrate: 128,
|
bitrate: 128,
|
||||||
|
requestOptions: {
|
||||||
|
headers: headers,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return stream
|
return stream
|
||||||
|
@@ -17,6 +17,7 @@ const __glob = {
|
|||||||
MEDIA_DB: root + path.sep + "data" + path.sep + "media.json",
|
MEDIA_DB: root + path.sep + "data" + path.sep + "media.json",
|
||||||
VERSION: version,
|
VERSION: version,
|
||||||
CHANGELOG_PATH: root + path.sep + "CHANGELOG.html",
|
CHANGELOG_PATH: root + path.sep + "CHANGELOG.html",
|
||||||
|
COOKIES: root + path.sep + "data" + path.sep + "cookies.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {__glob}
|
module.exports = {__glob}
|
Reference in New Issue
Block a user