private IDictionary<int, string> GetPages(IChapterRecord chapter)
{
IDictionary<int, string> pages = new Dictionary<int, string>();
var document = WebHelper.GetHtmlDocument(chapter.Url);
var scriptNode = document.SelectSingleNode(@"//div[@id=""image_frame""]/following-sibling::script");
if (scriptNode == null)
{
throw new ParserException("Could not find expected elements on website.", document.InnerHtml);
}
var scriptText = scriptNode.InnerText;
int page = 1;
foreach (Match match in _pagesRegex.Matches(scriptText))
{
pages.Add(page, GetFullUrl(match.Groups[1].Captures[0].Value));
page++;
}
return pages;
}