Spaces:
Paused
Paused
File size: 503 Bytes
5ed446f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import { SPOTIFY_API } from "./config.js"
const support_type = ['song', 'playlist']
const handle = async (type, id, cookie = '') => {
let result
const query = `?server=spotify&type=${type}&id=${id}`
if (support_type.includes(type)) {
result = await fetch(SPOTIFY_API + query)
result = await result.json()
} else {
result = -1
}
return result
}
export default {
register: (ctx) => {
ctx.register('spotify', { handle, support_type })
}
}
|