mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
hotfix
This commit is contained in:
1 parent
b0f816e60b
commit
54d09d1b64
1 file changed
+34
-10
@@ -220,17 +220,41 @@ const SearchMixin = {
|
|||||||
const canonicalYtUrl = ytId ? Utils.normalizeYouTubeUrl(query) : null;
|
const canonicalYtUrl = ytId ? Utils.normalizeYouTubeUrl(query) : null;
|
||||||
const searchQuery = (isUrl && canonicalYtUrl) ? canonicalYtUrl : query;
|
const searchQuery = (isUrl && canonicalYtUrl) ? canonicalYtUrl : query;
|
||||||
|
|
||||||
let result;
|
let playlistQuery = null;
|
||||||
try {
|
if (isUrl && ytId && canonicalYtUrl) {
|
||||||
if (isUrl) {
|
try {
|
||||||
result = await this._lavalink.search(searchQuery);
|
const listId = new URL(query.trim()).searchParams.get("list");
|
||||||
} else {
|
if (listId) playlistQuery = canonicalYtUrl + "&list=" + listId;
|
||||||
result = await this._lavalink.search(searchQuery, { source });
|
} catch (_) { /* ignore malformed URLs */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
let result = null;
|
||||||
|
let usedPlaylistQuery = false;
|
||||||
|
if (isUrl && playlistQuery) {
|
||||||
|
try {
|
||||||
|
result = await this._lavalink.search(playlistQuery);
|
||||||
|
usedPlaylistQuery = true;
|
||||||
|
} catch (searchErr) {
|
||||||
|
logger.warn("[Player] Playlist load failed:", searchErr?.message);
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
if ((result?.tracks?.length ?? 0) === 0) {
|
||||||
|
usedPlaylistQuery = false;
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!usedPlaylistQuery) {
|
||||||
|
try {
|
||||||
|
if (isUrl) {
|
||||||
|
result = await this._lavalink.search(searchQuery);
|
||||||
|
} else {
|
||||||
|
result = await this._lavalink.search(searchQuery, { source });
|
||||||
|
}
|
||||||
|
} catch (searchErr) {
|
||||||
|
logger.warn("[Player] URL/primary search failed:", searchErr?.message);
|
||||||
|
result = null;
|
||||||
|
if (!isUrl) throw searchErr;
|
||||||
}
|
}
|
||||||
} catch (searchErr) {
|
|
||||||
logger.warn("[Player] URL/primary search failed:", searchErr?.message);
|
|
||||||
result = null;
|
|
||||||
if (!isUrl) throw searchErr;
|
|
||||||
}
|
}
|
||||||
let lcTracks = result?.tracks ?? [];
|
let lcTracks = result?.tracks ?? [];
|
||||||
let fromTitleFallback = false;
|
let fromTitleFallback = false;
|
||||||
|
|||||||
Reference in new issue
Block a user