Example #1
0
        /// <summary>
        /// Method to retrieve app name
        /// </summary>
        /// <param name="appID"></param>
        /// <param name="v"></param>
        private void RetrieveAppName(string appID, int v)
        {
            try
            {
                string url     = "https://itunes.apple.com/rss/customerreviews/page=" + v + "/id=" + appID + "/sortby=mostrecent/json";
                var    request = WebRequest.Create(url);
                request.ContentType = "application/json; charset=utf-8";
                string text;
                var    response = (HttpWebResponse)request.GetResponse();

                using (var sr = new StreamReader(response.GetResponseStream()))
                {
                    text = sr.ReadToEnd();
                    text = text.Replace("im:name", "AppName").Replace("im:image", "Image");
                }

                JObject jsonObject = JObject.Parse(text);
                Apple_User_Review_Sniffer.RootObject deserializedObject = JsonConvert.DeserializeObject <Apple_User_Review_Sniffer.RootObject>(jsonObject.ToString());
                appName = deserializedObject.feed.entry[0].AppName.label;
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// Server call to retrieve reviews
        /// </summary>
        /// <param name="appID"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        private List <string> makeServerCall(string appID, int page)
        {
            List <string> allReviews = new List <string>();

            try
            {
                string url     = "https://itunes.apple.com/rss/customerreviews/page=" + page + "/id=" + appID + "/sortby=mostrecent/json";
                var    request = WebRequest.Create(url);
                request.ContentType = "application/json; charset=utf-8";
                string text;
                var    response = (HttpWebResponse)request.GetResponse();

                using (var sr = new StreamReader(response.GetResponseStream()))
                {
                    text = sr.ReadToEnd();
                }
                JObject jsonObject = JObject.Parse(text);
                Apple_User_Review_Sniffer.RootObject deserializedObject = JsonConvert.DeserializeObject <Apple_User_Review_Sniffer.RootObject>(jsonObject.ToString());
                foreach (var entry in deserializedObject.feed.entry)
                {
                    if (entry != null)
                    {
                        try
                        {
                            allReviews.Add(entry.content.label);
                        }
                        catch (Exception exq)
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //error
                return(null);
            }
            return(allReviews);
        }