From 493e13ebc0eed812575a4cf181e76062a139817b Mon Sep 17 00:00:00 2001 From: jeffvli Date: Fri, 9 Jun 2023 14:50:14 -0700 Subject: [PATCH] Fix id return type on netease fetcher --- src/main/features/core/lyrics/netease.ts | 8 +++----- .../features/lyrics/components/lyrics-search-form.tsx | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/features/core/lyrics/netease.ts b/src/main/features/core/lyrics/netease.ts index d2722e9a..8ebfde8e 100644 --- a/src/main/features/core/lyrics/netease.ts +++ b/src/main/features/core/lyrics/netease.ts @@ -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 | null> { const results = await getSearchResults(params); - console.log('results', results); - const firstMatch = results?.[0]; if (!firstMatch || (firstMatch?.score && firstMatch.score > 0.5)) { diff --git a/src/renderer/features/lyrics/components/lyrics-search-form.tsx b/src/renderer/features/lyrics/components/lyrics-search-form.tsx index c56cf19c..effe6a2b 100644 --- a/src/renderer/features/lyrics/components/lyrics-search-form.tsx +++ b/src/renderer/features/lyrics/components/lyrics-search-form.tsx @@ -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 (