public static async Task <Gift[]> GetOnlineGift(DateTime now, IBigoServer server, CookieContainer cc) { var time = Tools.GetCurrentUnixTimeMillseconds(now); var random = "7317262808793148"; var url = $"https://activity.bigo.tv/live/giftconfig/getOnlineGifts?jsoncallback=id_{time}_{random}"; var res = await server.GetAsync(url); var match = System.Text.RegularExpressions.Regex.Match(res, "^id_\\d+_\\d+\\((.+)\\)$"); if (!match.Success) { throw new SpecChangedException(res); } var json = match.Groups[1].Value; var gifts = JsonConvert.DeserializeObject <Gift[]>(json); return(gifts); }
public static async Task <WebSocketLink> GetWebSocketLink(IBigoServer server, CookieContainer cc) { var url = "https://www.bigo.tv/studio/getWebSocketLink"; var res = await server.GetAsync(url); dynamic d = JsonConvert.DeserializeObject(res); if (!d.ContainsKey("code") || d.code != 0) { throw new NotImplementedException(); } var uidToken = ((string)d.data.uidToken).Replace("###VER2", ""); var deviceId = (string)d.data.deviceId; var userId = (string)d.data.userId; var ret = new WebSocketLink { DeviceId = deviceId, UidToken = uidToken, UserId = userId, }; return(ret); }