public static string StopLive(int roomid, string cookie) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(StopLiveUrl); Utils.SetHttpHeaders(request, "pc", cookie); request.Headers.Add("Origin", "https://link.bilibili.com"); request.Referer = "https://link.bilibili.com/p/center/index"; string jct = Bilibili.GetJCT(cookie); string content = $"room_id={roomid}&platform=pc&csrf_token={jct}&csrf={jct}"; return(Utils.HttpPOST(request, content)); }
public static string UpdateLiveTitle(int roomid, string title, string cookie) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(InfoUpdateUrl); Utils.SetHttpHeaders(request, "pc", cookie); request.Headers.Add("Origin", LiveRoomUrl); request.Referer = $"{LiveRoomUrl}/{roomid}"; string jct = Bilibili.GetJCT(cookie); string content = $"room_id={roomid}&title={Utils.UrlEncode(title)}&platform=pc&csrf_token={jct}&csrf={jct}&visit_id="; return(Utils.HttpPOST(request, content)); }
public static string SendDanmaku(int roomid, string msg, string cookie) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(PostDanmakuUrl); Utils.SetHttpHeaders(request, "pc", cookie); request.Host = "api.live.bilibili.com"; request.Referer = "https://live.bilibili.com/" + roomid; request.Headers.Add("Origin", "https://live.bilibili.com"); long t = Utils.GetTimeStamp(); string jct = Bilibili.GetJCT(cookie); string content = $"color=16777215&fontsize=25&mode=1&bubble=0&msg={Utils.UrlEncode(msg)}&rnd={t}&roomid={roomid}&csrf={jct}&csrf_token={jct}"; return(Utils.HttpPOST(request, content)); }