From b5978e63b8ad8ee202fe3940e4fac30be071f172 Mon Sep 17 00:00:00 2001 From: Ted Zyzsdy Date: Fri, 1 Mar 2019 15:33:50 +0800 Subject: [PATCH] fix new api (#26) --- BiLiRoku/Bililivelib/Downloader.cs | 2 ++ BiLiRoku/Bililivelib/PathFinder.cs | 6 +++--- BiLiRoku/Commentlib/CommentProvider.cs | 2 +- BiLiRoku/MainWindow.xaml | 4 ++-- BiLiRoku/Properties/AssemblyInfo.cs | 8 ++++---- BiLiRoku/Version.cs | 8 ++++---- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/BiLiRoku/Bililivelib/Downloader.cs b/BiLiRoku/Bililivelib/Downloader.cs index 271ff3f..c9afb8a 100644 --- a/BiLiRoku/Bililivelib/Downloader.cs +++ b/BiLiRoku/Bililivelib/Downloader.cs @@ -197,6 +197,8 @@ private async void CommentProvider_OnReceivedComment(object sender, ReceivedComm { try { + //DEBUG: 弹幕显示测试 + _mw.AppendLogln("收到弹幕", e.Comment.CommentUser + ": " + e.Comment.CommentText); //接收到弹幕时的处理。 if (e.Comment.MsgType != MsgTypeEnum.LiveStart) { diff --git a/BiLiRoku/Bililivelib/PathFinder.cs b/BiLiRoku/Bililivelib/PathFinder.cs index 6efd5d4..97a4559 100644 --- a/BiLiRoku/Bililivelib/PathFinder.cs +++ b/BiLiRoku/Bililivelib/PathFinder.cs @@ -73,7 +73,7 @@ internal Task GetTrueUrl(string roomid) AddInfo("ERROR", "房间号获取错误。"); throw new Exception("No roomid"); } - var apiUrl = "https://api.live.bilibili.com/api/playurl?cid=" + roomid + "&otype=json&quality=0&platform=web"; + var apiUrl = "https://api.live.bilibili.com/room/v1/Room/playUrl?cid=" + roomid + "&otype=json&quality=0&platform=web"; SendStat(roomid); //访问API获取结果 @@ -98,13 +98,13 @@ internal Task GetTrueUrl(string roomid) try { var jsonResult = JObject.Parse(resultString); - var trueUrl = jsonResult["durl"][0]["url"].ToString(); + var trueUrl = jsonResult["data"]["durl"][0]["url"].ToString(); AddInfo("INFO", "地址解析成功:" + trueUrl); return trueUrl; } catch (Exception e) { - AddInfo("ERROR", "解析XML失败:" + e.Message); + AddInfo("ERROR", "视频流地址解析失败:" + e.Message); throw; } }); diff --git a/BiLiRoku/Commentlib/CommentProvider.cs b/BiLiRoku/Commentlib/CommentProvider.cs index 79dd350..768f47e 100644 --- a/BiLiRoku/Commentlib/CommentProvider.cs +++ b/BiLiRoku/Commentlib/CommentProvider.cs @@ -14,7 +14,7 @@ namespace BiliRoku.Commentlib { internal class CommentProvider { - private const int CmtPort = 788; + private const int CmtPort = 2243; private readonly string _roomid; private readonly MainWindow _mw; private bool _connected; //连接情况 diff --git a/BiLiRoku/MainWindow.xaml b/BiLiRoku/MainWindow.xaml index a062e88..7f616f0 100644 --- a/BiLiRoku/MainWindow.xaml +++ b/BiLiRoku/MainWindow.xaml @@ -17,7 +17,7 @@