Ejemplo n.º 1
0
 public string getViewers()
 {
     try
     {
         using (WebClientTimeOut wc = new WebClientTimeOut(500))
         {
             string  info = wc.DownloadString(String.Format(chatUsers, chatId));
             JObject jObj = JsonConvert.DeserializeObject <JObject>(info);
             JArray  arr  = (JArray)jObj["text"];
             return(arr.Count.ToString());
         }
     }
     catch (Exception e)
     {
         Debug.Print("Exception on parsing userId from gamersTV: " + e.Message);
         return("0");
     }
 }
Ejemplo n.º 2
0
 public string getViewers()
 {
     try
     {
         using (WebClientTimeOut wc = new WebClientTimeOut(1000))
         {
             string info       = wc.DownloadString(String.Format(channelInfoUrl, channelName));
             int    startIndex = info.IndexOf("{\"userinfo\"");
             info = info.Substring(startIndex, info.Length - startIndex - 1);
             JObject jObj = JsonConvert.DeserializeObject <JObject>(info);
             return(jObj["viewers"]["cnt"].ToString());
         }
     }
     catch (Exception e)
     {
         Debug.Print("Exception on parsing viewers on gohaTV: " + e.Message);
         return("0");
     }
 }