Ejemplo n.º 1
0
        public static string GetRealRtmp(ulong roomid)
        {
            string room_info = GetRoomJsonString(roomid);
            Dictionary <string, string> jsonDict = JsonHandle.GetDict(room_info);

            if (jsonDict == null)
            {
                return(null);
            }
            string rtmp_url  = jsonDict["data.rtmp_url"];
            string rtmp_live = jsonDict["data.rtmp_live"];
            string rtmputl   = rtmp_url + "/" + rtmp_live;

            return(rtmputl);
        }
Ejemplo n.º 2
0
        public static string GetRoomJsFromUrl(string douyuUrl)
        {
            ulong rid = GetRidFromUrl(douyuUrl);

            if (rid == 0)
            {
                return(null);
            }
            string api_roomjs = "https://www.douyu.com/swf_api/homeH5Enc?rids=" + rid;

            try
            {
                var dict = JsonHandle.GetDict(HttpReq.ReqUrl(api_roomjs));
                return(dict["data.room" + rid]);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public static int GetRoomStatus(ulong rid)
        {
            string jsonstr = GetRoomInfoString(rid);
            Dictionary <string, string> dict = JsonHandle.GetDict(jsonstr);

            if (dict == null)
            {
                return(0);
            }
            if (!dict.ContainsKey("data.room_status"))
            {
                return(0);
            }
            int status = 0;

            if (int.TryParse(dict["data.room_status"], out status))
            {
                return(status);
            }
            return(0);
        }