Пример #1
0
        public static TwitterSchema Parse(this TwitterTimeLineItem item)
        {
            TwitterSchema twit = new TwitterSchema
            {
                _id              = item.id_str,
                Text             = Utility.DecodeHtml(item.text),
                CreationDateTime = TryParse(item.created_at)
            };

            if (item.user == null)
            {
                twit.UserId              = string.Empty;
                twit.UserName            = string.Empty;
                twit.UserScreenName      = string.Empty;
                twit.UserProfileImageUrl = string.Empty;
                twit.Url = string.Empty;
            }
            else
            {
                twit.UserId              = item.user.id_str;
                twit.UserName            = Utility.DecodeHtml(item.user.name);
                twit.UserScreenName      = string.Concat("@", Utility.DecodeHtml(item.user.screen_name));
                twit.UserProfileImageUrl = item.user.profile_image_url;
                twit.Url = string.Format("https://twitter.com/{0}/status/{1}", item.user.screen_name, item.id_str);
                if (!string.IsNullOrEmpty(twit.UserProfileImageUrl))
                {
                    twit.UserProfileImageUrl = twit.UserProfileImageUrl.Replace("_normal", string.Empty);
                }
            }

            return(twit);
        }
        public static TwitterSchema Parse(this TwitterTimeLineItem item)
        {
            TwitterSchema twit = new TwitterSchema
            {
                _id = item.id_str,
                Text = Utility.DecodeHtml(item.text),
                CreationDateTime = TryParse(item.created_at)
            };

            if (item.user == null)
            {
                twit.UserId = string.Empty;
                twit.UserName = string.Empty;
                twit.UserScreenName = string.Empty;
                twit.UserProfileImageUrl = string.Empty;
                twit.Url = string.Empty;
            }
            else
            {
                twit.UserId = item.user.id_str;
                twit.UserName = Utility.DecodeHtml(item.user.name);
                twit.UserScreenName = string.Concat("@", Utility.DecodeHtml(item.user.screen_name));
                twit.UserProfileImageUrl = item.user.profile_image_url;
                twit.Url = string.Format("https://twitter.com/{0}/status/{1}", item.user.screen_name, item.id_str);
                if (!string.IsNullOrEmpty(twit.UserProfileImageUrl))
                {
                    twit.UserProfileImageUrl = twit.UserProfileImageUrl.Replace("_normal", string.Empty);
                }
            }

            return twit;
        }