Exemplo n.º 1
0
        public static string StartLive(int roomid, int area, string cookie)
        {
            HttpWebRequest request = null;

            try
            {
                request = (HttpWebRequest)WebRequest.Create(StartLiveUrl);
                Bilibili.SetHeaders(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&area_v2={area}&csrf_token={jct}&csrf={jct}";
                return(Bilibili.POST(request, content));
            }
            catch (Exception e)
            {
                request?.Abort();
                Common.AppData.CQLog.Error("lua插件错误", $"post错误:{e.Message}");
            }
            return("");
        }
Exemplo n.º 2
0
        public static string UpdateLiveTitle(int roomid, string title, string cookie)
        {
            HttpWebRequest request = null;

            try
            {
                request = (HttpWebRequest)WebRequest.Create(InfoUpdateUrl);
                Bilibili.SetHeaders(request, "pc", cookie);
                request.Headers.Add("Origin", LiveRoomUrl);
                request.Referer = $"{LiveRoomUrl}/{roomid}";
                string jct     = Bilibili.GetJCT(cookie);
                string content = $"room_id={roomid}&title={UrlEncode(title)}&platform=pc&csrf_token={jct}&csrf={jct}&visit_id=";
                return(Bilibili.POST(request, content));
            }
            catch (Exception e)
            {
                request?.Abort();
                Common.AppData.CQLog.Error("lua插件错误", $"post错误:{e.Message}");
            }
            return("");
        }
Exemplo n.º 3
0
        public static string SendDanmaku(int roomid, string msg, string cookie)
        {
            HttpWebRequest request = null;

            try
            {
                request = (HttpWebRequest)WebRequest.Create(PostDanmakuUrl);
                Bilibili.SetHeaders(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       = Bilibili.GetTimeStamp();
                string jct     = Bilibili.GetJCT(cookie);
                string content = $"color=16777215&fontsize=25&mode=1&bubble=0&msg={UrlEncode(msg)}&rnd={t}&roomid={roomid}&csrf={jct}&csrf_token={jct}";
                return(Bilibili.POST(request, content));
            }
            catch (Exception e)
            {
                request?.Abort();
                Common.AppData.CQLog.Error("lua插件错误", $"post错误:{e.Message}");
            }
            return("");
        }