Esempio n. 1
0
        public static ulong GetRidFromUrl(string douyuUrl)
        {
            string resRoomContent = HttpReq.OpenDyRoom(douyuUrl);
            var    match          = Regex.Match(resRoomContent, @"\$ROOM.room_id\D+(\d+);");

            if (match.Success)
            {
                ulong rid;
                if (ulong.TryParse(match.Groups[1].Value, out rid))
                {
                    return(rid);
                }
            }
            return(0);
        }
Esempio 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);
            }
        }
Esempio n. 3
0
        public static string GetRoomInfoString(ulong rid)
        {
            string api = "http://open.douyucdn.cn/api/RoomApi/room/" + rid.ToString();

            return(HttpReq.ReqUrl(api));
        }