From e4d1e307dfae11b7c8b1fe0b6fea659a2a25890c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 18 Sep 2024 19:12:35 +0200 Subject: [PATCH] fix: no longer get token from youtube (#174) Close #173 Reviewed-on: https://git.mylloon.fr/ConfrerieDuKassoulait/Botanique/pulls/174 Co-authored-by: Mylloon Co-committed-by: Mylloon --- src/utils/client.ts | 11 +---------- src/utils/music.ts | 14 -------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/utils/client.ts b/src/utils/client.ts index 1893ded..14a3874 100644 --- a/src/utils/client.ts +++ b/src/utils/client.ts @@ -5,7 +5,6 @@ import { Database } from "sqlite3"; import "../modules/client"; import { loadLocales } from "./locales"; import { YoutubeiExtractor } from "discord-player-youtubei"; -import { YoutubeWebTokenRoutine } from "./music"; /** Creation of the client and definition of its properties */ export default async (isDev: boolean) => { @@ -45,9 +44,6 @@ export default async (isDev: boolean) => { list: new Collection(), }; - // Generate tokens - const tokens = await YoutubeWebTokenRoutine(true); - const player = Player.singleton(client, { skipFFmpeg: true, ytdlOptions: { @@ -56,12 +52,7 @@ export default async (isDev: boolean) => { }, }); await player.extractors.loadDefault((ext) => ext !== "YouTubeExtractor"); - await player.extractors.register(YoutubeiExtractor, { - streamOptions: { - useClient: "WEB", - }, - trustedTokens: tokens, - }); + await player.extractors.register(YoutubeiExtractor, {}); console.log("Translations progression :"); client.locales = await loadLocales(client.config.default_lang); diff --git a/src/utils/music.ts b/src/utils/music.ts index da84263..176f18d 100644 --- a/src/utils/music.ts +++ b/src/utils/music.ts @@ -2,7 +2,6 @@ import { EmbedBuilder } from "@discordjs/builders"; import { GuildQueue, QueueRepeatMode } from "discord-player"; import { Client } from "discord.js"; import { getLocale } from "./locales"; -import { generateTrustedToken, YoutubeiExtractor } from "discord-player-youtubei"; export const embedListQueue = ( client: Client, @@ -58,16 +57,3 @@ const printRepeatMode = (mode: QueueRepeatMode, loc: Map) => { break; } }; - -export const YoutubeWebTokenRoutine = async (first: boolean) => { - // Repeat in one week : 7 * 24 * 60 * 60 * 1000 - setTimeout(YoutubeWebTokenRoutine, 604800000, false); - - const tokens = await generateTrustedToken(); - if (first) { - return tokens; - } - - const instance = YoutubeiExtractor.getInstance(); - instance?.setTrustedTokens(tokens); -};