protected override List <PhotoDownload> DoImageDownload(PhotoInput photoInput) { //Console.WriteLine(Resource.readingUrl); var web = new HtmlWeb(); var page = web.Load(photoInput.Url).DocumentNode; photoInput.Path = page.QuerySelector("h1.category-heading").InnerText.Trim().RemoveInvalidPathChars(); photoInput.FullPath = PhotoPath + photoInput.Path; Photo.WriteRootInfoFile(photoInput); var gallery = page.QuerySelectorAll("figure.media a"); var listPhotoDownload = new List <PhotoDownload>(); foreach (var imageFrame in gallery) { var photoDownload = new PhotoDownload { Url = imageFrame.GetAttributeValue("data-article", ""), Status = false, Title = HttpUtility.HtmlDecode(imageFrame.GetAttributeValue("data-title", "")) }; photoDownload.Name = Photo.GetName(photoDownload.Url); photoDownload.Path = Path.GetFullPath(photoInput.FullPath) + "\\" + photoDownload.Name; listPhotoDownload.Add(photoDownload); } return(listPhotoDownload); }
protected override List <PhotoDownload> DoImageDownload(PhotoInput photoInput) { Console.WriteLine(Resource.readingUrl); var web = new HtmlWeb(); var page = web.Load(photoInput.Url).DocumentNode; photoInput.Path = page.QuerySelector("h1.container_12.title").InnerText.Trim().RemoveInvalidPathChars(); photoInput.FullPath = PhotoPath + photoInput.Path; photoInput.Desc = page.QuerySelector("div.container_12.lead").InnerText.Trim(); Photo.WriteRootInfoFile(photoInput); var listPhotoDownload = new List <PhotoDownload>(); //var gallery = page.QuerySelectorAll("div.tumblr.hide-mobile"); var gallery = page.QuerySelectorAll("section.container_12.content div.single_photo"); foreach (var imageFrame in gallery) { var photoDownload = new PhotoDownload { Url = imageFrame.QuerySelector("img.article_img").GetAttributeValue("src", ""), //imageFrame.GetAttributeValue("data-content", ""), Status = false, Title = HttpUtility.HtmlDecode(imageFrame.QuerySelector("div.text").InnerText) //HttpUtility.HtmlDecode(imageFrame.GetAttributeValue("data-caption", "")) }; photoDownload.Name = Photo.GetName(photoDownload.Url); photoDownload.Path = Path.GetFullPath(photoInput.FullPath) + "\\" + photoDownload.Name; listPhotoDownload.Add(photoDownload); } return(listPhotoDownload); }
protected override List <PhotoDownload> DoImageDownload(PhotoInput photoInput) { //Console.WriteLine(Resource.readingUrl); var web = new HtmlWeb(); var page = web.Load(photoInput.Url).DocumentNode; photoInput.Path = page.QuerySelector("title").InnerText.Trim().RemoveInvalidPathChars().RemoveInvalidSputnikPhotoChars(); if (photoInput.Path.Contains("This Week in Pictures")) { photoInput.Path = photoInput.Path + "\\" + DateTime.ParseExact(photoInput.Url.Substring(30, 8), "yyyyMMdd", CultureInfo.InvariantCulture).ToString("MMMM dd yyyy"); } photoInput.FullPath = PhotoPath + photoInput.Path; photoInput.Desc = HttpUtility.HtmlDecode(page.QuerySelector("div.b-article__text").InnerText.Trim()); Photo.WriteRootInfoFile(photoInput); var gallery = page.QuerySelector("#gallery").QuerySelectorAll("li"); var listPhotoDownload = new List <PhotoDownload>(); foreach (var imageFrame in gallery) { var photoDownload = new PhotoDownload { Url = imageFrame.GetAttributeValue("data-src", ""), Status = false, Title = HttpUtility.HtmlDecode(imageFrame.GetAttributeValue("data-sub-html", "")) }; photoDownload.Name = Photo.GetName(photoDownload.Url); photoDownload.Path = Path.GetFullPath(photoInput.FullPath) + "\\" + photoDownload.Name; listPhotoDownload.Add(photoDownload); } return(listPhotoDownload); }