This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
sonist
Archived
1
0
Fork 0
sonist/js/api.js

139 lines
2.6 KiB
JavaScript

/**
* 音乐APP接口
* @author yutent<yutent@doui.cc>
* @date 2018/12/24 16:02:00
*/
'use strict'
import request from '/dist/request/index.js'
const log = console.log
const BASE_API_URI = 'http://mobilecdnbj.kugou.com'
const get = uri => {
return request.get(BASE_API_URI + uri)
}
const post = uri => {
return request.post(BASE_API_URI + uri)
}
export default {
getLastHot100Artists() {
return get('/api/v5/singer/list')
.send({
sort: 1,
showtype: 1,
sextype: 0,
musician: 0,
pagesize: 100,
plat: 2,
type: 0,
page: 1
})
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text)
}
})
},
getArtistList(sextype = 1, type = 1) {
return get('/api/v5/singer/list')
.send({
showtype: 2,
musician: 0,
type,
sextype
})
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text)
}
})
},
getArtistInfo(singerid) {
return get('/api/v3/singer/info')
.send({ singerid })
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text)
}
})
},
getArtistInfo(singerid) {
return get('/api/v3/singer/info')
.send({ singerid })
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text)
}
})
},
getArtistSongs(singerid, page = 1) {
return get('/api/v3/singer/song')
.send({
sorttype: 2,
pagesize: 50,
singerid,
area_code: 1,
page
})
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text)
}
})
},
getArtistAlbums(singerid, page = 1) {
return get('/api/v3/singer/album')
.send({
pagesize: 50,
singerid,
area_code: 1,
page
})
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text)
}
})
},
search(keyword) {
return request
.get('https://songsearch.kugou.com/song_search_v2')
.send({
keyword,
platform: 'WebFilter',
tag: ''
})
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text).data.lists
}
})
},
getSongInfoByHash(hash, album_id = '') {
return request
.get('https://wwwapi.kugou.com/yy')
.send({
r: 'play/getdata',
hash,
album_id
})
.then(res => {
if (res.status === 200) {
return JSON.parse(res.text).data
}
})
}
}
一个音乐播放器, 主打本地音乐播放。支持 自动歌词/自动封面/均衡器等常见功能。
JavaScript 60.1%
SCSS 19.2%
HTML 16.9%
CSS 3.8%