Skip to content

Commit 0894c6d

Browse files
committed
feat: add pack kami
0 parents  commit 0894c6d

File tree

5 files changed

+453
-0
lines changed

5 files changed

+453
-0
lines changed

kami/functions/bangumi.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
async function handler() {
2+
const extra = await require('@mx-space/extra')
3+
const { BiliClient } = extra
4+
const bl = await context.getMaster().then((user) => user.socialIds.bilibili)
5+
const client = new BiliClient(parseInt(bl || uid))
6+
const bangumi = await client.getFavoriteBangumi(parseInt(len))
7+
return bangumi
8+
}
9+
10+
const uid = 26578164
11+
const len = 10

kami/functions/netease.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
async function handler(ctx, require) {
2+
const extra = await require('@mx-space/extra')
3+
const { NeteaseMusic } = extra
4+
5+
const client = new NeteaseMusic(phone, password)
6+
await client.Login()
7+
8+
const weekdata = await client.getWeekData()
9+
const alldata = await client.getAllData()
10+
const playlist = await client.getFavorite()
11+
12+
const responsePayload = {
13+
playlist,
14+
weekdata,
15+
alldata,
16+
}
17+
18+
return responsePayload
19+
}
20+
21+
const phone = ''
22+
const password = ''

kami/functions/song.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
async function handler(ctx, require) {
2+
const { NeteaseCloudMusicApi } = await require('@mx-space/extra')
3+
const { song_url } = NeteaseCloudMusicApi
4+
const id = ctx.req.query.id
5+
if (!id) {
6+
return { message: 'id must be not empty stringnumber' }
7+
}
8+
const data = await song_url({
9+
id: +id,
10+
})
11+
12+
return data.body.data
13+
}

kami/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "kami",
3+
"dependencies": {
4+
"@mx-space/extra": "latest"
5+
}
6+
}

0 commit comments

Comments
 (0)