5.3.9 - Fix Soundcloud not working/Фикс ошибки SC

This commit is contained in:
JonnyBro 2022-10-31 14:15:30 +05:00
parent fd5c3034f9
commit 0ab06128ac
2 changed files with 4 additions and 4 deletions

View file

@ -467,8 +467,8 @@ class Player extends EventEmitter<PlayerEvents> {
const track = new Track(this, {
title: song.name,
description: "",
author: song.publisher.name ?? "Unknown Publisher",
url: song.url,
author: song.publisher?.name ?? "Unknown",
url: song.permalink,
thumbnail: song.thumbnail,
duration: Util.buildTimeCode(Util.parseMS(song.durationInMs)),
views: 0,

View file

@ -630,7 +630,7 @@ class Queue<T = unknown> {
let stream = null;
const hasCustomDownloader = typeof this.onBeforeCreateStream === "function";
if (["youtube", "spotify"].includes(track.raw.source)) {
if (["youtube", "spotify", "soundcloud"].includes(track.raw.source)) {
const url = track.raw.source === "spotify" ? track.raw.engine : track.url;
if (!url) return void this.play(this.tracks.shift(), { immediate: true });
@ -644,7 +644,7 @@ class Queue<T = unknown> {
} else {
const arbitraryStream = (hasCustomDownloader && (await this.onBeforeCreateStream(track, track.raw.source || track.raw.engine, this))) || null;
stream =
arbitraryStream || (track.raw.source === "soundcloud" && typeof track.raw.engine?.downloadProgressive === "function")
arbitraryStream
? await track.raw.engine.downloadProgressive()
: typeof track.raw.engine === "function"
? await track.raw.engine()