mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +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] = {
|
||||
title: `${extractedSongInfo.title}`,
|
||||
artist: `${extractedSongInfo.artist}`,
|
||||
album: `${extractedSongInfo.album}`,
|
||||
songDuration: extractedSongInfo.songDuration,
|
||||
};
|
||||
|
||||
if (extractedSongInfo.album) {
|
||||
songData.album = extractedSongInfo.album;
|
||||
}
|
||||
|
||||
let lyrics;
|
||||
try {
|
||||
lyrics = await getLyricsList(songData);
|
||||
@ -78,9 +81,9 @@ export const getLyricsList = async (
|
||||
track_name: songData.title,
|
||||
});
|
||||
|
||||
query.set('album_name', songData.album!);
|
||||
if (query.get('album_name') === 'undefined') {
|
||||
query.delete('album_name');
|
||||
|
||||
if (songData.album) {
|
||||
query.set('album_name', songData.album);
|
||||
}
|
||||
|
||||
let url = `https://lrclib.net/api/search?${query.toString()}`;
|
||||
|
||||
Reference in New Issue
Block a user