mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-19 06:02:06 +00:00
fix(synced-lyrics): LRCLIB returns 0 results if album is undefined
- inspired by #2381
This commit is contained in:
@ -52,10 +52,13 @@ export const makeLyricsRequest = async (extractedSongInfo: SongInfo) => {
|
|||||||
const songData: Parameters<typeof getLyricsList>[0] = {
|
const songData: Parameters<typeof getLyricsList>[0] = {
|
||||||
title: `${extractedSongInfo.title}`,
|
title: `${extractedSongInfo.title}`,
|
||||||
artist: `${extractedSongInfo.artist}`,
|
artist: `${extractedSongInfo.artist}`,
|
||||||
album: `${extractedSongInfo.album}`,
|
|
||||||
songDuration: extractedSongInfo.songDuration,
|
songDuration: extractedSongInfo.songDuration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (extractedSongInfo.album) {
|
||||||
|
songData.album = extractedSongInfo.album;
|
||||||
|
}
|
||||||
|
|
||||||
let lyrics;
|
let lyrics;
|
||||||
try {
|
try {
|
||||||
lyrics = await getLyricsList(songData);
|
lyrics = await getLyricsList(songData);
|
||||||
@ -78,9 +81,9 @@ export const getLyricsList = async (
|
|||||||
track_name: songData.title,
|
track_name: songData.title,
|
||||||
});
|
});
|
||||||
|
|
||||||
query.set('album_name', songData.album!);
|
|
||||||
if (query.get('album_name') === 'undefined') {
|
if (songData.album) {
|
||||||
query.delete('album_name');
|
query.set('album_name', songData.album);
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = `https://lrclib.net/api/search?${query.toString()}`;
|
let url = `https://lrclib.net/api/search?${query.toString()}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user