mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
Update lyric fetcher return types
This commit is contained in:
parent
007a099951
commit
d38c846e80
5 changed files with 14 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import axios, { AxiosResponse } from 'axios';
|
||||
import { load } from 'cheerio';
|
||||
import type { InternetProviderLyricResponse, QueueSong } from '/@/renderer/api/types';
|
||||
import { LyricSource } from '../../../../renderer/types';
|
||||
|
||||
const SEARCH_URL = 'https://genius.com/api/search/song';
|
||||
|
||||
|
|
@ -8,7 +9,7 @@ const SEARCH_URL = 'https://genius.com/api/search/song';
|
|||
|
||||
interface GeniusResponse {
|
||||
artist: string;
|
||||
title: string;
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ async function getSongURL(metadata: QueueSong): Promise<GeniusResponse | undefin
|
|||
|
||||
return {
|
||||
artist: hit.artist_names,
|
||||
title: hit.full_title,
|
||||
name: hit.full_title,
|
||||
url: hit.url,
|
||||
};
|
||||
}
|
||||
|
|
@ -76,6 +77,7 @@ export async function query(metadata: QueueSong): Promise<InternetProviderLyricR
|
|||
return {
|
||||
artist: response.artist,
|
||||
lyrics,
|
||||
title: response.title,
|
||||
name: response.name,
|
||||
source: LyricSource.GENIUS,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import axios, { AxiosResponse } from 'axios';
|
||||
import type { InternetProviderLyricResponse, QueueSong } from '/@/renderer/api/types';
|
||||
import { LyricSource } from '../../../../renderer/types';
|
||||
|
||||
const SEARCH_URL = 'https://music.163.com/api/search/get';
|
||||
const LYRICS_URL = 'https://music.163.com/api/song/lyric';
|
||||
|
|
@ -9,7 +10,7 @@ const LYRICS_URL = 'https://music.163.com/api/song/lyric';
|
|||
interface NetEaseResponse {
|
||||
artist: string;
|
||||
id: string;
|
||||
title: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
async function getSongId(metadata: QueueSong): Promise<NetEaseResponse | undefined> {
|
||||
|
|
@ -37,7 +38,7 @@ async function getSongId(metadata: QueueSong): Promise<NetEaseResponse | undefin
|
|||
return {
|
||||
artist,
|
||||
id: song.id,
|
||||
title: song.name,
|
||||
name: song.name,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +76,7 @@ export async function query(metadata: QueueSong): Promise<InternetProviderLyricR
|
|||
return {
|
||||
artist: response.artist,
|
||||
lyrics,
|
||||
title: response.title,
|
||||
name: response.name,
|
||||
source: LyricSource.NETEASE,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue