예제 #1
0
파일: Crawler.cs 프로젝트: lq-wq/Jvedio
        protected override void ParseCookies(string SetCookie)
        {
            if (SetCookie == null)
            {
                return;
            }
            List <string> Cookies = new List <string>();
            var           values  = SetCookie.Split(new char[] { ',', ';' }).ToList();

            foreach (var item in values)
            {
                if (item.IndexOf('=') < 0)
                {
                    continue;
                }
                string key   = item.Split('=')[0];
                string value = item.Split('=')[1];
                if (key == "__cfduid" || key == "is_loyal")
                {
                    Cookies.Add(key + "=" + value);
                }
            }
            string cookie = string.Join(";", Cookies);
            Uri    uri    = new Uri(Url);

            if (!UrlCookies.ContainsKey(uri.Host))
            {
                UrlCookies.Add(uri.Host, cookie);
            }
            else
            {
                UrlCookies[uri.Host] = cookie;
            }
            SaveCookies();
        }
예제 #2
0
파일: Crawler.cs 프로젝트: lq-wq/Jvedio
        protected override void InitHeaders()
        {
            Uri    uri    = new Uri(Url);
            string cookie = "";

            if (UrlCookies.ContainsKey(uri.Host))
            {
                cookie = UrlCookies[uri.Host];
            }
            headers = new CrawlerHeader()
            {
                Cookies = cookie
            };
        }
예제 #3
0
파일: Crawler.cs 프로젝트: lq-wq/Jvedio
        protected void InitHeaders(string postdata)
        {
            //sn=pppd-093
            if (!Url.IsProperUrl())
            {
                return;
            }
            Uri    uri    = new Uri(Url);
            string cookie = "";

            if (UrlCookies.ContainsKey(uri.Host))
            {
                cookie = UrlCookies[uri.Host];
            }
            headers = new CrawlerHeader()
            {
                ContentLength = postdata.Length + 3,
                Origin        = uri.Scheme + "://" + uri.Host,
                ContentType   = "application/x-www-form-urlencoded",
                Referer       = uri.Scheme + "://" + uri.Host,
                Method        = "POST",
                Cookies       = cookie
            };
        }