更新酷狗歌曲信息接口

This commit is contained in:
dengtongyu committed 2019-05-19 23:28:54 +08:00
1 parent 92655b6b7c
commit a8e9c78aeb
1 file changed
+15 -1
+15 -1
View File
@@ -7,6 +7,17 @@
const request = require('request'); const request = require('request');
function randomString(len) {
  len = len || 32;
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  var maxPos = chars.length;
  var pwd = '';
  for (i = 0; i < len; i++) {
    pwd += chars.charAt(Math.floor(Math.random() * maxPos));
  }
  return pwd;
}
module.exports = { module.exports = {
getSearchSongList:function(param,req,callback){ getSearchSongList:function(param,req,callback){
@@ -58,8 +69,11 @@ module.exports = {
let proxy_url = 'http://www.kugou.com/yy/index.php?r=play/getdata&hash='+hash; let proxy_url = 'http://www.kugou.com/yy/index.php?r=play/getdata&hash='+hash;
let options = { let options = {
headers: {"Connection": "close"},
url: proxy_url, url: proxy_url,
headers: {
"Connection": "close",
"Cookie":"kg_mid="+randomString()
},
method: req.method.toUpperCase(), method: req.method.toUpperCase(),
json: true, json: true,
body: req.body body: req.body