Skip to content

Commit 922e091

Browse files
committed
feat(kami): update snippet
1 parent 6fbfd20 commit 922e091

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.lock.json
2+
pnpm-lock.yaml
3+
yarn.lock

kami/functions/netease.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
import extra from '@mx-space/extra'
22

33
async function handler() {
4-
const { NeteaseMusic } = extra
4+
const { NeteaseMusic, NeteaseCloudMusicApi } = extra
55

66
const client = new NeteaseMusic(phone, password)
77
await client.Login()
88

9+
const uid = await client.getAccount()
10+
911
const weekdata = await client.getWeekData()
1012
const alldata = await client.getAllData()
1113
const playlist = await client.getFavorite()
1214

15+
const detail = await NeteaseCloudMusicApi.user_detail({
16+
uid,
17+
}).then((res) => (res.body.code === 200 ? res.body.profile : null))
18+
1319
const responsePayload = {
1420
playlist,
1521
weekdata,
1622
alldata,
23+
detail,
1724
}
1825

1926
return responsePayload
2027
}
2128

29+
/// CONFIGS ///
2230
const phone = ''
2331
const password = ''
32+
/// CONFIGS END ///

kami/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kami",
33
"dependencies": {
4-
"@mx-space/extra": "latest"
4+
"@mx-space/extra": "0.5.5"
55
}
66
}

tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"compilerOptions": {
33
"target": "ES2017",
44
"allowJs": true,
5-
"noEmit": true
5+
"noEmit": true,
6+
"moduleResolution": "node",
7+
"esModuleInterop": true,
8+
"module": "CommonJS"
69
}
710
}

0 commit comments

Comments
 (0)