protected override void ParseRecord(IDbContainer dbContainer, IAudioBook record, string postHtml) { record.ClearMetaInfo(); var document = new HtmlDocument(); document.LoadHtml(postHtml); var topicMain = document.GetElementbyId("topic_main"); var postBody = topicMain?.Descendants().FirstOrDefault(item => item.HasClass("post_body")); if (postBody != null) { var elementsByRows = ParsePostBodyElementsByRows(postBody.InnerHtml); var sizeElement = document.DocumentNode.Descendants() .FirstOrDefault(item => item.HasClass("attach_link") && item.HasClass("guest")); if (sizeElement != null && sizeElement.ChildNodes.Count >= 2) { var sizeNode = sizeElement.LastChild; var size = GetSizeInBytes(sizeNode.InnerText.ReplaceAll(new[] { "·", " " }, " ") .Trim(' ', '\t')); record.Size = size; } foreach (var element in elementsByRows) { FillRecordElement(record, element.Key.TrimEnd(':'), element.Value); } } }
protected override void ParseRecord(IDbContainer dbContainer, IAudioBook record, string postHtml) { record.ClearMetaInfo(); var document = new HtmlDocument(); document.LoadHtml(postHtml); var postBody = document.DocumentNode.Descendants("div") .FirstOrDefault(item => item.GetAttributeValue("id", "").StartsWith("news-id-")); if (postBody != null) { var elementsByRows = ParsePostBodyElementsByRows(postBody.InnerHtml); if (elementsByRows.TryGetValue("Общий размер", out var sizeText)) { var size = GetSizeInBytes(sizeText); record.Size = size; } foreach (var element in elementsByRows) { FillRecordElement(record, element.Key.TrimEnd(':'), element.Value); } } }