forked from akinazuki/NeteaseCloudMusic-Audio-Recognize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.js
More file actions
19 lines (16 loc) · 803 Bytes
/
run.js
File metadata and controls
19 lines (16 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import ncmutils from './src/lib'
import fs from 'fs'
const buffer = fs.readFileSync("./lavieenrose.mp3")
const encoded = await ncmutils.encode(buffer)
const result = await ncmutils.recognize(encoded)
result.forEach((item, index) => {
console.log(`[${index + 1}] ${item.song.name} - ${item.song.artists.map(artist => artist.name).join('/')} Album: 「${item.song.album.name}」 CID: [${item.song.id}]`)
console.log(item)
})
const lyrics = await ncmutils.lyrics(result[0].song.id)
console.log(lyrics)
// console.log(result)
// console.log(`Matched result count: ${result.length}`)
// result.forEach((item, index) => {
// console.log(`[${index + 1}] ${item.song.name} - ${item.song.artists.map(artist => artist.name).join('/')} Album: 「${item.song.album.name}」 CID: [${item.song.id}]`)
// })