public Segment GetSegment(HtmlNode segmentDiv, string day)
{
var imgDiv = segmentDiv.SelectSingleNode("./div[@class='programListContentImgArea']");
var txtDiv = segmentDiv.SelectSingleNode("./div[@class='programListContentTextArea scheduleColumnTextArea']");
var anchor = txtDiv.GetChildById("hypProgramTxt");
var authorNode = txtDiv.GetChildById("lblAuthor");
var imageNode = imgDiv.SelectSingleNode(".//img");
//TODO: Move url building (below) into UrlBuilder class
var segment = new Segment
{
DayDescription = day,
Title = anchor.DecodeHtml(),
SegmentDetailUrl = configurationManager.BookTvDomain + anchor.GetAttributeValue("href", ""),
Time = txtDiv.GetChildById("lblAirTime").DecodeHtml(),
Duration = txtDiv.GetChildById("lblLength").DecodeHtml(),
Author = (authorNode == null) ? "" : authorNode.DecodeHtml(),
ImageUrl = configurationManager.BookTvDomain + imageNode.Attributes["src"].Value,
};
segment.DurationInMinutes = durationParser.GetDurationInMinutes(segment.Duration);
segment.Date = dayParser.Parse(segment.DayDescription);
return segment;
}