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); }
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); } }
public static string GetRoomInfoString(ulong rid) { string api = "http://open.douyucdn.cn/api/RoomApi/room/" + rid.ToString(); return(HttpReq.ReqUrl(api)); }