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;
|
if (!rawSongsResult) return null;
|
||||||
|
|
||||||
const songResults: InternetProviderLyricSearchResponse[] = rawSongsResult.map((song: any) => {
|
const songResults: InternetProviderLyricSearchResponse[] = rawSongsResult.map((song) => {
|
||||||
const artist = song.artists ? song.artists.map((artist: any) => artist.name).join(', ') : '';
|
const artist = song.artists ? song.artists.map((artist) => artist.name).join(', ') : '';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
artist,
|
artist,
|
||||||
id: song.id,
|
id: String(song.id),
|
||||||
name: song.name,
|
name: song.name,
|
||||||
source: LyricSource.NETEASE,
|
source: LyricSource.NETEASE,
|
||||||
};
|
};
|
||||||
|
@ -115,8 +115,6 @@ async function getMatchedLyrics(
|
||||||
): Promise<Omit<InternetProviderLyricResponse, 'lyrics'> | null> {
|
): Promise<Omit<InternetProviderLyricResponse, 'lyrics'> | null> {
|
||||||
const results = await getSearchResults(params);
|
const results = await getSearchResults(params);
|
||||||
|
|
||||||
console.log('results', results);
|
|
||||||
|
|
||||||
const firstMatch = results?.[0];
|
const firstMatch = results?.[0];
|
||||||
|
|
||||||
if (!firstMatch || (firstMatch?.score && firstMatch.score > 0.5)) {
|
if (!firstMatch || (firstMatch?.score && firstMatch.score > 0.5)) {
|
||||||
|
|
|
@ -40,9 +40,7 @@ const SearchResult = ({ data, onClick }: SearchResultProps) => {
|
||||||
}, [score]);
|
}, [score]);
|
||||||
|
|
||||||
const cleanId =
|
const cleanId =
|
||||||
source === LyricSource.GENIUS
|
source === LyricSource.GENIUS ? id.replace(/^((http[s]?|ftp):\/)?\/?([^:/\s]+)/g, '') : id;
|
||||||
? String(id).replace(/^((http[s]?|ftp):\/)?\/?([^:/\s]+)/g, '')
|
|
||||||
: id;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SearchItem onClick={onClick}>
|
<SearchItem onClick={onClick}>
|
||||||
|
|
Reference in a new issue