78 lines
2.3 KiB
JavaScript
78 lines
2.3 KiB
JavaScript
/**
|
|
*
|
|
* @authors Your Name (you@example.org)
|
|
* @date 2017-08-03 10:29:18
|
|
* @version $Id$
|
|
*/
|
|
|
|
const request = require('request');
|
|
|
|
module.exports = {
|
|
|
|
getSearchSongList:function(param,req,callback){
|
|
//let proxy_url = 'http://songsearch.kugou.com/song_search_v2?keyword='+param+'&page=1&pagesize=30&userid=-1&clientver=&platform=WebFilter&tag=em&filter=2&iscorrection=1&privilege_filter=0&_='+Date.now();
|
|
let proxy_url = 'http://songsearch.kugou.com/song_search_v2?' + param + '&_='+Date.now();
|
|
let options = {
|
|
headers: {"Connection": "close"},
|
|
url: proxy_url,
|
|
method: req.method,
|
|
json: true,
|
|
body: req.body
|
|
};
|
|
|
|
console.log(req.method);
|
|
|
|
request(options, function(error, response, data){
|
|
if (!error && response.statusCode == 200) {
|
|
//console.log('------接口代理数据------',response,data);
|
|
|
|
if(callback) callback(data);
|
|
//res.json(data)
|
|
}
|
|
});
|
|
},
|
|
|
|
getNewSongList:function(param,req,callback){
|
|
let proxy_url = 'http://m.kugou.com/?' + param;
|
|
let options = {
|
|
headers: {"Connection": "close"},
|
|
url: proxy_url,
|
|
method: req.method,
|
|
json: true,
|
|
body: req.body
|
|
};
|
|
|
|
console.log(req.method);
|
|
|
|
request(options, function(error, response, data){
|
|
if (!error && response.statusCode == 200) {
|
|
//console.log('------接口代理数据------',response,data);
|
|
|
|
if(callback) callback(data);
|
|
//res.json(data)
|
|
}
|
|
});
|
|
},
|
|
|
|
getSongMsg:function(hash,req,callback){
|
|
let proxy_url = 'http://www.kugou.com/yy/index.php?r=play/getdata&hash='+hash;
|
|
|
|
let options = {
|
|
headers: {"Connection": "close"},
|
|
url: proxy_url,
|
|
method: req.method.toUpperCase(),
|
|
json: true,
|
|
body: req.body
|
|
};
|
|
|
|
request(options, function(error, response, data){
|
|
if (!error && response.statusCode == 200) {
|
|
//console.log('------接口数据------',data);
|
|
|
|
if(callback) callback(data);
|
|
//res.json(data)
|
|
}
|
|
});
|
|
}
|
|
|
|
} |