From dc33761cfe8fc461907ba766c13919c69ea7a2a3 Mon Sep 17 00:00:00 2001 From: 707 <707472783@qq.com> Date: Tue, 30 Aug 2016 23:42:06 +0800 Subject: [PATCH] update protocol --- app/config.json | 2 +- app/danmu/danmu.js | 3 ++- app/player/player.js | 2 +- app/player/system.js | 1 + log/log.txt | 3 +++ log/playlist.txt | 1 + test/netease.js | 9 +++++---- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/config.json b/app/config.json index 1980076..184ed71 100644 --- a/app/config.json +++ b/app/config.json @@ -1 +1 @@ -{"music":"true","desktopDanmu":"true"} \ No newline at end of file +{"music":"true","desktopDanmu":"false"} \ No newline at end of file diff --git a/app/danmu/danmu.js b/app/danmu/danmu.js index fe18b33..978f091 100644 --- a/app/danmu/danmu.js +++ b/app/danmu/danmu.js @@ -1,9 +1,10 @@ const http = require('http'); const net = require('net'); +const CHATROOM = 'http://riven.panda.tv/chatroom/getinfo?roomid='; exports.getChatInfo = function getChatInfo(roomid, callback) { - http.get('http://www.panda.tv/ajax_chatinfo?roomid=' + roomid, function(res) { + http.get(CHATROOM + roomid, function(res) { res.on('data', function(chunk) { const json = JSON.parse(chunk); const jsonData = json.data; diff --git a/app/player/player.js b/app/player/player.js index 1e20700..2eafca6 100644 --- a/app/player/player.js +++ b/app/player/player.js @@ -20,7 +20,7 @@ exports.search = function search(name, callback) { }; exports.select = function select(num) { - id = JSON.parse(searchList).result.songs[num - 1].id; + id = JSON.parse(searchList)[num - 1].id; console.log(id); if (id) { getMusicUrl(); diff --git a/app/player/system.js b/app/player/system.js index e30e70a..e3c5552 100644 --- a/app/player/system.js +++ b/app/player/system.js @@ -5,6 +5,7 @@ function getDanmu(danmu) { const diange = danmuParse(danmu[2]); if (diange && diange[0] === 'diange') { player.search(diange[1], () => { + // 默认选择第一首歌 player.select(1); }); } diff --git a/log/log.txt b/log/log.txt index e69de29..9591e84 100644 --- a/log/log.txt +++ b/log/log.txt @@ -0,0 +1,3 @@ +8/30/2016, 10:52:12 PM 点歌成功 +8/30/2016, 10:52:56 PM 切歌成功 +8/30/2016, 10:53:06 PM 点歌成功 diff --git a/log/playlist.txt b/log/playlist.txt index c10f6c1..551943a 100644 --- a/log/playlist.txt +++ b/log/playlist.txt @@ -1 +1,2 @@ 播放列表 +1. 理想三旬 diff --git a/test/netease.js b/test/netease.js index 7e21f88..9485c72 100644 --- a/test/netease.js +++ b/test/netease.js @@ -1,8 +1,9 @@ const {api} = require('NeteaseCloudMusicApi'); -// api.search('理想三旬', (data) => { -// console.log(JSON.parse(data).result.songs[0].id); -// }, 10); -api.song('31445772', (data) => { +api.search('玫瑰', (data) => { + console.log(JSON.parse(data)[0].id); + // console.log(JSON.parse(data).result.songs[0].id); +}, 10); +api.song('28053533', (data) => { console.log(data); console.log(JSON.parse(data).songs[0].mp3Url); });