Beispiel #1
0
 partial void UpdateImgLink(ImgLink instance);
Beispiel #2
0
 partial void DeleteImgLink(ImgLink instance);
Beispiel #3
0
 partial void InsertImgLink(ImgLink instance);
Beispiel #4
0
        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());
            }
        }
Beispiel #5
0
 public void SaveImg(ImgLink img)
 {
     _context.ImgLinks.InsertOnSubmit(img);
     _context.SubmitChanges();
 }
Beispiel #6
0
        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());
            }
        }
Beispiel #7
0
        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());
            }
        }