コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }