初始化项目
This commit is contained in:
commit
28f327c903
19 files changed
+434
No files matched your search
@@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
const Service = require('egg').Service;
|
||||
|
||||
class KuGouService extends Service {
|
||||
async getSearchSongList(param) {
|
||||
try {
|
||||
const header = {
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
...param,
|
||||
_: Date.now(),
|
||||
},
|
||||
};
|
||||
const url = 'http://songsearch.kugou.com/song_search_v2';
|
||||
const res = await this.ctx.curl(url, header);
|
||||
return res.data;
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
async getNewSongList(param) {
|
||||
try {
|
||||
const header = {
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
...param,
|
||||
_: Date.now(),
|
||||
},
|
||||
};
|
||||
const url = 'http://m.kugou.com/';
|
||||
const res = await this.ctx.curl(url, header);
|
||||
return res.data;
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
async getSongMsg(hash) {
|
||||
try {
|
||||
const header = {
|
||||
method: 'GET',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
hash,
|
||||
r: 'play/getdata',
|
||||
},
|
||||
};
|
||||
const url = 'http://www.kugou.com/yy/index.php';
|
||||
const res = await this.ctx.curl(url, header);
|
||||
return res.data;
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = KuGouService;
|
||||
Reference in new issue
Block a user