public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "xemlasuong.org")) { return; } var lst = new List <ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@class = 'blog-single-para']"); if (divContainer == null) { return; } HtmlNodeCollection nodeImagesCollection = divContainer.SelectNodes("//img"); foreach (var node in nodeImagesCollection) { try { string strLink = node.Attributes["src"].Value; string strClass = node.Attributes["class"] != null ? node.Attributes["class"].Value : string.Empty; if (strClass.Contains("size-full")) { var item = new ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "xemlasuong.org", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } if (lst.Count > 0) { bolService.SaveImg(lst); Console.WriteLine(strPage); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "phunuvn.net")) { return; } var lst = new List <ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//blockquote[@class = 'messageText ugc baseHtml']"); if (divContainer == null) { return; } HtmlNodeCollection nodeImagesCollection = divContainer.SelectNodes("//img[@class = 'bbCodeImage LbImage']"); foreach (var node in nodeImagesCollection) { try { string strLink = node.Attributes["src"].Value; var item = new ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "phunuvn.net", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } if (lst.Count > 0) { bolService.SaveImg(lst); Console.WriteLine(strPage); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void XinhHayLaLoop(string category, string strPage) { try { var bolService = new BOLService.BOLService(); var lst = new List <ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid URL string strCounter = strPage.Substring(strPage.LastIndexOf('/') + 1); HtmlNode nodeTitle = doc.DocumentNode.SelectSingleNode("//h1[@class = 'title']"); string strTitle = nodeTitle != null ? nodeTitle.InnerText : string.Empty; //TODO: Check exist Link bool existCouter = bolService.CheckExistLinkByDomain(strCounter, "xinh.hay.la"); if (!existCouter) { TestImageOnePage(strPage, strCounter, category, strTitle); } var divContainer = doc.DocumentNode.SelectSingleNode("//div[@class = 'navButtons']"); if (divContainer == null) { return; } foreach (HtmlNode node in divContainer.ChildNodes) { try { if (node.Name == "a" && node.Attributes["class"].Value == "prev") { string strLoopPage = string.Format("http://xinh.hay.la{0}", node.Attributes["href"].Value); XinhHayLaLoop(category, strLoopPage); break; } } catch (Exception e) { Console.WriteLine(e.ToString()); } } } catch (Exception exception) { //log4net.Config.XmlConfigurator.Configure(); //log.Info("Error: " + exception); Console.WriteLine(exception.ToString()); } }
public static void XinhHayLaDaily(string catagory, string strURL) { try { var bolService = new BOLService.BOLService(); var lst = new List <ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strURL); //TODO: Check valid URL var divContainer = doc.DocumentNode.SelectSingleNode("//div[@class = 'items post']"); if (divContainer == null) { return; } foreach (HtmlNode node in divContainer.ChildNodes) { if (node != null && node.Name == "div") { try { foreach (HtmlNode childNode in node.ChildNodes) { if (childNode.Name.Equals("a")) { HtmlNode nodeDivImage = childNode.SelectSingleNode("//div[@class = 'contest-item-image']"); HtmlNode nodeImage = nodeDivImage.SelectSingleNode("//img"); string strImg = nodeImage.Attributes["src"].Value; if (strImg.Contains("Content/themes/noimg_big.jpg")) { break; } string strPage = string.Format("http://xinh.hay.la{0}", childNode.Attributes["href"].Value); string strCounter = strPage.Substring(strPage.LastIndexOf('/') + 1); HtmlNode nodeTitle = childNode.SelectSingleNode("//div[@class = 'ext-info title']"); string strTitle = nodeTitle != null ? nodeTitle.InnerText : string.Empty; //TODO: Check exist Link if (!bolService.CheckExistLinkByDomain(strCounter, "xinh.hay.la")) { TestImageOnePage(strPage, strCounter, catagory, strTitle); } break; } } } catch (Exception e) { Console.WriteLine(e.ToString()); } } } } catch (Exception exception) { //log4net.Config.XmlConfigurator.Configure(); //log.Info("Error: " + exception); Console.WriteLine(exception.ToString()); } Console.WriteLine("Finish " + catagory + " ^_^"); }
public static void ProcessDetailPage(string strPage) { try { var bolService = new BOLService.BOLService(); var lst = new List <BOLService.ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//ul[@class = 'pic clearfix']"); if (divContainer == null) { return; } foreach (HtmlNode childNode in divContainer.ChildNodes) { if (childNode.HasChildNodes && childNode.Name.Equals("li")) { foreach (var node in childNode.ChildNodes) { if (node.Name.Equals("img") && node.Attributes["src"] != null) { try { string strLink = node.Attributes["src"].Value; strLink = strLink.Replace("/upload_x/", "/upload_big/"); var item = new BOLService.ImgLink() { Category = "Girl", Counter = strLink, CreateDate = DateTime.Now, Domain = "tgod.cn", GroupName = "TGOD", linkimg = strLink }; if (!bolService.CheckExistLinkByDomain(strLink, "tgod.cn")) { lst.Add(item); Console.WriteLine(strLink); } } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } } } } if (lst.Count > 0) { bolService.SaveImgDepVD(lst); Console.WriteLine(strPage); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "xemanh.net")) { return; } var lst = new List <ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@id = 'main']"); if (divContainer == null) { return; } HtmlNode articleNode = divContainer.SelectSingleNode("//article"); HtmlNode sectionNode = articleNode.SelectSingleNode("//section"); foreach (var node in sectionNode.ChildNodes) { try { if (node.Name.Equals("p") && node.HasAttributes && node.HasChildNodes) { HtmlNode nodeA = node.FirstChild; if (node.ChildNodes.Count > 1) { foreach (HtmlNode f1Node in node.ChildNodes) { if (f1Node.Name.Equals("a") || f1Node.Name.Equals("img")) { nodeA = f1Node; break; } } } HtmlNode nodeImg = nodeA; if (nodeA.Name.Equals("a") && nodeA.HasChildNodes) { foreach (HtmlNode fNode in nodeA.ChildNodes) { if (fNode.Name.Equals("img")) { nodeImg = fNode; break; } } } if (nodeImg != null && nodeImg.Name.Equals("img") && nodeImg.Attributes["src"] != null) { string strLink = nodeImg.Attributes["src"].Value; var item = new ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "xemanh.net", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } } } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } if (lst.Count > 0) { bolService.SaveImg(lst); Console.WriteLine(strPage); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "xiuren.org")) { Console.WriteLine("Exist :" + strCounter); return; } var lst = new List <BOLService.ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@id = 'main']"); if (divContainer == null) { return; } HtmlNodeCollection nodeImagesCollection = divContainer.SelectNodes("//span[@class = 'photoThum']"); foreach (HtmlNode childNode in nodeImagesCollection) { if (childNode.HasChildNodes) { foreach (var node in childNode.ChildNodes) { if (node.Name.Equals("a") && node.Attributes["title"] != null) { try { string strLink = node.Attributes["href"].Value; var item = new BOLService.ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "xiuren.org", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } } } } if (lst.Count > 0) { bolService.SaveImgDepVD(lst); Console.WriteLine(strPage); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "ugirls.com")) { Console.WriteLine("Exist :" + strCounter); return; } var lst = new List <BOLService.ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@class = 'main auto']"); if (divContainer == null) { return; } HtmlNodeCollection nodeImagesCollection = divContainer.SelectNodes("//div[@class = 'img']"); if (nodeImagesCollection.Count > 0) { foreach (HtmlNode node in nodeImagesCollection.First().ChildNodes) { if (node.Name.Equals("ul") && node.Attributes["id"] != null && node.Attributes["id"].Value.Equals("myGallery")) { foreach (HtmlNode childNode in node.ChildNodes) { if (childNode.HasChildNodes && childNode.Name.Equals("li")) { foreach (var nodeThumb in childNode.ChildNodes) { if (nodeThumb.Name.Equals("img") && nodeThumb.Attributes["src"] != null) { try { string strLink = nodeThumb.Attributes["src"].Value; strLink = strLink.Replace("_magazine_web_m", ""); var item = new BOLService.ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "ugirls.com", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } } } } if (lst.Count > 0) { bolService.SaveImgDepVD(lst); Console.WriteLine(strPage); } break; } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public static void TestImageOnePage(string strPage, string strCounter, string category, string strTitle) { try { var bolService = new BOLService.BOLService(); if (bolService.CheckExistLinkByDomain(strCounter, "tructiepso.com")) { return; } var lst = new List <ImgLink>(); var web = new HtmlWeb(); var doc = web.Load(strPage); //TODO: Check valid var divContainer = doc.DocumentNode.SelectSingleNode("//div[@class = 'entry-content rich-content']"); if (divContainer == null) { divContainer = doc.DocumentNode.SelectSingleNode("//div[@id = 'content_document']"); if (divContainer == null) { return; } } HtmlNodeCollection nodeImagesCollection = divContainer.SelectNodes("//img"); foreach (var node in nodeImagesCollection) { try { string strLink = node.Attributes["src"].Value; if (!strLink.Contains("tructiepso.com/wp-content/uploads") && !strLink.Contains("gamer.gif")) { var item = new ImgLink() { Category = category, Counter = strCounter, CreateDate = DateTime.Now, Domain = "tructiepso.com", GroupName = strTitle, linkimg = strLink }; lst.Add(item); } } catch (Exception ex) { //TODO: show error; Console.WriteLine(ex.ToString()); } } if (lst.Count > 0) { bolService.SaveImg(lst); Console.WriteLine(strPage); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }