1 Star 0 Fork 36

abinzhao / vue-music163

forked from xiongmao1114 / vue-music163 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
postdemo.js 866 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiongmao1114 提交于 2016-11-17 17:34 . 11-17
var http=require('http');
var querystring = require('querystring');
var postData ={
'csrf_token': "",
's': "王菲",
'type':1,
'offset':0,
'limit':5,
'total':true
};
var options = {
method: "POST",
host: "music.163.com",
port: 80,
path: "/api/search/get/web",
headers: {
"Content-Type": 'application/x-www-form-urlencoded',
'Referer': 'http://music.163.com/search/'
}
};
var req = http.request(options, function(res) {
res.setEncoding('utf8');
var resData = [];
res.on('data', function (chunk) {
resData.push(chunk);
});
res.on('end', function() {
var data = resData.join("");
console.log(JSON.parse(data));
})
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
// 发送请求
req.write(querystring.stringify(postData));
req.end();
JavaScript
1
https://gitee.com/abinzhao/vue-music163.git
git@gitee.com:abinzhao/vue-music163.git
abinzhao
vue-music163
vue-music163
master

搜索帮助