コード例 #1
0
        public static void GetJavCookieChromeProcess()
        {
            Broswer.OpenBrowserUrl("http://www.javlibrary.com/cn/");
            Thread.Sleep(8 * 1000);
            Broswer.Refresh_click();
            Thread.Sleep(15 * 1000);
            Broswer.Refresh_click();
            Thread.Sleep(5 * 1000);

            var cookies = new ChromeCookieReader().ReadChromeCookies(".javlibrary.com");

            foreach (var c in cookies)
            {
                System.Net.Cookie coo = new System.Net.Cookie();

                if (c.Name.Contains("cf"))
                {
                    coo.Name   = c.Name;
                    coo.Value  = c.Value;
                    coo.Domain = "www.javlibrary.com";

                    cc.Add(coo);
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            CookieContainer cc = new CookieContainer();

            var cookieData = new ChromeCookieReader().ReadCookies("115");

            var json = JsonConvert.SerializeObject(cookieData.Where(x => !x.Value.Contains(",")).Distinct());

            ScanDataBaseManager.InsertOneOneFiveCookie(new OneOneFiveCookieModel
            {
                OneOneFiveCookie = json
            });
        }
コード例 #3
0
        public static CookieContainer Get115Cookie()
        {
            CookieContainer cc = new CookieContainer();

            var cookieData = new ChromeCookieReader().ReadCookies("115");

            foreach (var item in cookieData.Where(x => !x.Value.Contains(",")).Distinct())
            {
                Cookie c = new Cookie(item.Name, item.Value, "/", "115.com");

                cc.Add(c);
            }

            return(cc);
        }
コード例 #4
0
        public string Save115Cookie(string cookie)
        {
            List <CookieItem> items = new List <CookieItem>();

            CookieContainer cc = new CookieContainer();

            var cookieData = new ChromeCookieReader().ReadCookies(".115.com");

            if (cookieData != null)
            {
                items.AddRange(cookieData);
            }

            try
            {
                if (!string.IsNullOrEmpty(cookie))
                {
                    foreach (var item in cookie.Split(';'))
                    {
                        items.Add(new CookieItem()
                        {
                            Name  = item.Split('=')[0].Trim(),
                            Value = item.Split('=')[1].Trim(),
                        });
                    }
                }

                if (items.Count > 0)
                {
                    ScanDataBaseManager.TruncateOneOneFiveCookie();

                    ScanDataBaseManager.InsertOneOneFiveCookie(new OneOneFiveCookieModel
                    {
                        OneOneFiveCookie = JsonConvert.SerializeObject(items)
                    });
                }
            }
            catch (Exception)
            {
                return("fail");
            }

            return("success");
        }
コード例 #5
0
        public static CookieContainer GetCookie()
        {
            CookieContainer cc      = new CookieContainer();
            var             process = Broswer.OpenBrowserUrl("http://www.javlibrary.com/cn/");

            Thread.Sleep(5000);
            Broswer.Refresh_click();
            Thread.Sleep(15000);
            Broswer.CloseBroswer();

            var data = new ChromeCookieReader().ReadCookies("javlibrary");

            foreach (var item in data.Where(x => !x.Value.Contains(",")).Distinct())
            {
                Cookie c = new Cookie(item.Name, item.Value, "/", "www.javlibrary.com");

                cc.Add(c);
            }

            cc.Add(new Cookie("over18", "18", "/", "www.javlibrary.com"));
            return(cc);
        }
コード例 #6
0
        private void FetchInfo(string url)
        {
            CookieContainer cc         = new CookieContainer();
            var             cookieData = new ChromeCookieReader().ReadCookies("javlibrary");

            foreach (var item in cookieData.Where(x => !x.Value.Contains(",")).Distinct())
            {
                Cookie c = new Cookie(item.Name, item.Value, "/", "www.javlibrary.com");

                cc.Add(c);
            }

            cc.Add(new Cookie("over18", "18", "/", "www.javlibrary.com"));

            var ret = HtmlManager.NeedToUpdateCookie(url, "utf-8", true, cc);
            var res = ret.Content;

            if (res.Success)
            {
                av = new AV();

                var m = Regex.Matches(res.Content, detailIDPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var data = item.Groups[1].Value;
                    av.ID = data;
                }

                m = Regex.Matches(res.Content, detailTitlePattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var data = item.Groups[2].Value.Replace(av.ID + " ", "");
                    av.Name = FileUtility.ReplaceInvalidChar(data);
                }

                m = Regex.Matches(res.Content, detailImgPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var data = item.Groups[1].Value.StartsWith("http") ? item.Groups[1].Value : "http:" + item.Groups[1].Value;
                    av.PictureURL = data;
                }

                m = Regex.Matches(res.Content, detailDatePattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var data = item.Groups[1].Value;
                    av.ReleaseDate = DateTime.Parse(data);
                }

                m = Regex.Matches(res.Content, detailLengthPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var data = item.Groups[1].Value;
                    av.AvLength = int.Parse(data);
                }

                m = Regex.Matches(res.Content, detailDirectorPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var u    = item.Groups[1].Value;
                    var data = item.Groups[2].Value;
                    av.Director += data + ",";
                }

                m = Regex.Matches(res.Content, detailCompanyPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var u    = item.Groups[1].Value;
                    var data = item.Groups[2].Value;
                    av.Company += data + ",";
                }

                m = Regex.Matches(res.Content, detailPublisherPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var u    = item.Groups[1].Value;
                    var data = item.Groups[2].Value;
                    av.Publisher += data + ",";
                }

                m = Regex.Matches(res.Content, detailCategoryPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var data = item.Groups[2].Value;
                    av.Category += data + ",";
                }

                m = Regex.Matches(res.Content, detailActressPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                foreach (Match item in m)
                {
                    var u    = item.Groups[1].Value;
                    var data = item.Groups[2].Value;
                    av.Actress += data + ",";
                }

                av.URL = url;
            }
        }