MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / extractSongInfo

Function extractSongInfo

convert/convert.ts:135–148  ·  view source on GitHub ↗
(response: string, userInput: string)

Source from the content-addressed store, hash-verified

133 let title = '', artist = '', album = '';
134 for (const line of lines) {
135 if (line.includes('歌曲名')) { title = line.split(/[::]/)[1]?.trim(); }
136 else if (line.includes('歌手')) { artist = line.split(/[::]/)[1]?.trim(); }
137 else if (line.includes('专辑')) { album = line.split(/[::]/)[1]?.trim(); }
138 }
139 return {
140 title: title || userInput,
141 artist: artist || '未知',
142 album: album || '未知',
143 };
144}
145
146async function searchAndDownloadCover(query: string, savePath: string): Promise<boolean> {
147 try {
148 const searchUrl = `https://itunes.apple.com/search?term=${encodeURIComponent(query)}&entity=song&limit=1`;
149 const { data } = await axios.get(searchUrl);
150 if (data.results && data.results.length > 0) {
151 let imageUrl = data.results[0].artworkUrl100;

Callers 1

handleVideoConversionMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected