Ada.Questions.PostFetcher.GetQuestion C# (CSharp) Метод

GetQuestion() публичный статический Метод

public static GetQuestion ( ActiveQuestion activeQuestion ) : Question
activeQuestion ActiveQuestion
Результат Question
        public static Question GetQuestion(ActiveQuestion activeQuestion)
        {
            var url = TrimUrl(activeQuestion.Url);
            var authorLink = TrimUrl(activeQuestion.OwnerUrl);

            var html = new WebClient().DownloadString(url);
            var dom = CQ.Create(html, Encoding.UTF8);

            var body = WebUtility.HtmlDecode(QuestionStatusDiv.Replace(dom[".post-text"].Html(), "").Trim());
            var score = int.Parse(dom[".vote-count-post"].Html());
            var creationDate = DateTime.MaxValue;

            foreach (var timestamp in dom[".post-signature .user-info .user-action-time .relativetime"])
            {
                var dt = DateTime.Parse(timestamp.Attributes["title"]);

                if (dt < creationDate)
                    creationDate = dt;
            }

            return new Question(activeQuestion.ID)
            {
                Url = url,
                Title = activeQuestion.TitleEncodedFancy,
                Body = body,
                Score = score,
                CreationDate = creationDate,
                AuthorName = activeQuestion.OwnerDisplayName,
                AuthorLink = authorLink,
                Tags = activeQuestion.Tags,
                Site = activeQuestion.SiteBaseHostAddress
            };
        }

Same methods

PostFetcher::GetQuestion ( string postUrl ) : Question