Esempio n. 1
0
        private BookDownloadItem[] ExtractItems(HtmlDocument doc, BookDownloadItem parent)
        {
            var result = new List <BookDownloadItem>();

            var links = doc.SelectNodes("//div[@id='download']/a");

            foreach (var link in links)
            {
                var item = parent.Clone();
                item.DownloadProvider = "bookdl";
                item.DownloadUrl      = link.Attributes["href"].Value;
                var className = link.Attributes["class"].Value;
                if (className.Contains("pdf"))
                {
                    item.Format = "pdf";
                }
                else if (className.Contains("epub"))
                {
                    item.Format = "epub";
                }
                else if (className.Contains("extras"))
                {
                    item.Format = "extras";
                }
                if (item.Format != null)
                {
                    result.Add(item);
                }
            }

            return(result.ToArray());
        }
Esempio n. 2
0
        private BookDownloadItem[] ExtractItems(HtmlDocument doc, BookDownloadItem parent)
        {
            var result = new List <BookDownloadItem>();

            var trs = doc.SelectNodes("//div[@id='download']/div[@class='panel-body']/table/tbody/tr");

            foreach (var tr in trs)
            {
                var item = parent.Clone();

                item.DownloadProvider = tr.SelectSingleNode("td[1]").InnerText;
                item.DownloadUrl      = tr.SelectSingleNode("td[2]/a").Attributes["href"].Value;
                item.Format           = tr.SelectSingleNode("td[3]").InnerText;

                result.Add(item);
            }

            return(result.ToArray());
        }