Fix id return type on netease fetcher
This commit is contained in:
parent
14aeee888f
commit
493e13ebc0
2 changed files with 4 additions and 8 deletions
|
@ -96,12 +96,12 @@ export async function getSearchResults(
|
|||
|
||||
if (!rawSongsResult) return null;
|
||||
|
||||
const songResults: InternetProviderLyricSearchResponse[] = rawSongsResult.map((song: any) => {
|
||||
const artist = song.artists ? song.artists.map((artist: any) => artist.name).join(', ') : '';
|
||||
const songResults: InternetProviderLyricSearchResponse[] = rawSongsResult.map((song) => {
|
||||
const artist = song.artists ? song.artists.map((artist) => artist.name).join(', ') : '';
|
||||
|
||||
return {
|
||||
artist,
|
||||
id: song.id,
|
||||
id: String(song.id),
|
||||
name: song.name,
|
||||
source: LyricSource.NETEASE,
|
||||
};
|
||||
|
@ -115,8 +115,6 @@ async function getMatchedLyrics(
|
|||
): Promise<Omit<InternetProviderLyricResponse, 'lyrics'> | null> {
|
||||
const results = await getSearchResults(params);
|
||||
|
||||
console.log('results', results);
|
||||
|
||||
const firstMatch = results?.[0];
|
||||
|
||||
if (!firstMatch || (firstMatch?.score && firstMatch.score > 0.5)) {
|
||||
|
|
|
@ -40,9 +40,7 @@ const SearchResult = ({ data, onClick }: SearchResultProps) => {
|
|||
}, [score]);
|
||||
|
||||
const cleanId =
|
||||
source === LyricSource.GENIUS
|
||||
? String(id).replace(/^((http[s]?|ftp):\/)?\/?([^:/\s]+)/g, '')
|
||||
: id;
|
||||
source === LyricSource.GENIUS ? id.replace(/^((http[s]?|ftp):\/)?\/?([^:/\s]+)/g, '') : id;
|
||||
|
||||
return (
|
||||
<SearchItem onClick={onClick}>
|
||||
|
|
Reference in a new issue