Version 1.1.3 - Modfication du Proxy
All checks were successful
Deployment Pipeline / deploy (push) Successful in 36s
All checks were successful
Deployment Pipeline / deploy (push) Successful in 36s
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chopin-backend",
|
"name": "chopin-backend",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"description": "Discord Bot for music - Fetching everywhere !",
|
"description": "Discord Bot for music - Fetching everywhere !",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
@@ -2,7 +2,6 @@ const {createAudioResource, VoiceConnectionStatus, createAudioPlayer, StreamType
|
|||||||
const {LogType} = require('loguix')
|
const {LogType} = require('loguix')
|
||||||
const clog = new LogType("Youtube-Stream")
|
const clog = new LogType("Youtube-Stream")
|
||||||
const ytdl = require('@distube/ytdl-core')
|
const ytdl = require('@distube/ytdl-core')
|
||||||
const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils");
|
|
||||||
const { __glob } = require('../../utils/GlobalVars');
|
const { __glob } = require('../../utils/GlobalVars');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
@@ -18,9 +17,11 @@ async function getStream(song) {
|
|||||||
'Chrome/116.0.5845.97 Safari/537.36',
|
'Chrome/116.0.5845.97 Safari/537.36',
|
||||||
'Accept-Language': 'en-US,en;q=0.9'
|
'Accept-Language': 'en-US,en;q=0.9'
|
||||||
};
|
};
|
||||||
|
|
||||||
var cookies = await JSON.parse(await fs.readFileSync(__glob.COOKIES, 'utf-8'));
|
var cookies = await JSON.parse(await fs.readFileSync(__glob.COOKIES, 'utf-8'));
|
||||||
ytdl.createAgent(cookies)
|
const proxy = await JSON.parse(await fs.readFileSync(__glob.PROXY, 'utf-8'));
|
||||||
let stream = ytdl(song.url, {
|
const agent = ytdl.createProxyAgent(proxy, cookies)
|
||||||
|
let stream = ytdl(song.url, {
|
||||||
quality: 'highestaudio',
|
quality: 'highestaudio',
|
||||||
highWaterMark: 1 << 30,
|
highWaterMark: 1 << 30,
|
||||||
liveBuffer: 20000,
|
liveBuffer: 20000,
|
||||||
@@ -28,7 +29,8 @@ async function getStream(song) {
|
|||||||
bitrate: 128,
|
bitrate: 128,
|
||||||
requestOptions: {
|
requestOptions: {
|
||||||
headers: headers,
|
headers: headers,
|
||||||
}
|
},
|
||||||
|
agent: agent,
|
||||||
});
|
});
|
||||||
|
|
||||||
return stream
|
return stream
|
||||||
|
@@ -17,7 +17,8 @@ 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"
|
COOKIES: root + path.sep + "data" + path.sep + "cookies.json",
|
||||||
|
PROXY: root + path.sep + "data" + path.sep + "proxy.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {__glob}
|
module.exports = {__glob}
|
Reference in New Issue
Block a user