Ejemplo n.º 1
0
        public JsonResult SaveJavSetting(string category, string url, string name)
        {
            var ret = 0;

            try
            {
                FaviScan fs = new FaviScan();

                fs.Category = category;
                fs.Url      = url;
                fs.Name     = name;

                ret = ScanDataBaseManager.InsertFaviScan(fs);
            }
            catch (Exception ee)
            {
                ApplicationLog.Debug(ee.ToString());
            }

            if (ret > 0)
            {
                return(Json(new { success = "success" }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { success = "fail" }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        private static void FaviScan(List <string> urls)
        {
            ScanDataBaseManager.DeleteFaviScan();

            Parallel.ForEach(urls, new ParallelOptions {
                MaxDegreeOfParallelism = 10
            }, url =>
            {
                var htmlRes = JavCookieContanierHelper(url);

                if (htmlRes.Success)
                {
                    HtmlDocument htmlDocument = new HtmlDocument();
                    htmlDocument.LoadHtml(htmlRes.Content);

                    var titlePath = "//div[@class='boxtitle']";

                    var titleNode = htmlDocument.DocumentNode.SelectSingleNode(titlePath);

                    if (titleNode != null)
                    {
                        var textArray = titleNode.InnerHtml.Trim().Split(' ');

                        var category = "";
                        var name     = textArray[0].Replace("&quot;", "");

                        if (textArray[1] == "所执导的影片")
                        {
                            category = "director";
                        }
                        else if (textArray[1] == "识别码搜寻结果")
                        {
                            category = "prfix";
                        }
                        else if (textArray[1] == "相关的影片")
                        {
                            category = "category";
                        }
                        else
                        {
                            category = "actress";
                        }

                        FaviScan fs = new FaviScan
                        {
                            Url      = url,
                            Name     = name,
                            Category = category
                        };

                        Console.WriteLine("扫描 " + url + " 分类 " + category + " 名称 " + name);
                        ScanDataBaseManager.InsertFaviScan(fs);
                    }
                }
            });
        }