public RanwenDownloader()
 {
     CurrentParameter = new DownloadParameter
         {
             UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
         };
 }
 public Ck101Downloader()
 {
     CurrentParameter = new DownloadParameter
         {
             UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
             Timeout = 10000
         };
 }
        public EynyDownloader(IPlugin plugin)
        {
            //var aes = new EncryptAes();
            //string url = string.Format("http://www02.eyny.com/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash=LiKaw&inajax=1");

            //ServicePointManager.Expect100Continue = false;

            //string postdata = "jNLWAPIFsJ0iWz7D00C09Fy1nAmQepY1y5cHlwqy0+75fQ1bfPELaZdYi/OKhAghQA0TiEVPd0wsFNCzNcVQNpqObZuZyl3DE18XX+Gwn0WBD7ARSRyDoyl8n0HpXAPIEuJgubT+X9mDY0ncZ5Tl7BnTKl0gJ79WwfclPChuPPU+S3MhyyLx2M/ugEgjDm8BrG7dRNRcXhzMBU6PhqqGLwASVuRjwg4wSvdORanK3GA=";
            //if (plugin.Configuration.ContainsKey("PostData"))
            //{
            //    if (!string.IsNullOrEmpty(plugin.Configuration["PostData"].Trim()))
            //    {
            //        postdata = plugin.Configuration["PostData"];
            //    }
            //}

            //byte[] data = Encoding.UTF8.GetBytes(aes.DecryptAes256(postdata));
            ////建立請求
            //var req = (HttpWebRequest)WebRequest.Create(url);
            //req.UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";
            //req.ContentType = "application/x-www-form-urlencoded";
            //req.ContentLength = data.Length;
            //req.Method = "POST";
            //req.CookieContainer = new CookieContainer();

            //using (var outstream = req.GetRequestStream())
            //{
            //    outstream.Write(data, 0, data.Length);
            //    outstream.Flush();
            //}
            ////關閉請求
            //req.GetResponse().Close();
            //CurrentParameter = new DownloadParameter
            //    {
            //    UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
            //    Cookies = req.CookieContainer
            //};

            CurrentParameter = new DownloadParameter
            {
                UserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
                Timeout = 10000
            };
        }
Example #4
0
        /// <summary>
        /// 取得網頁網始碼
        /// </summary>
        /// <param name="para"></param>
        /// <param name="encode"></param>
        /// <param name="proxy"></param>
        /// <returns></returns>
        public static string GetHtmlSource(DownloadParameter para, System.Text.Encoding encode, WebProxy proxy)
        {
            //再來建立你要取得的Request
            var webReq = (HttpWebRequest)WebRequest.Create(para.Url);

            webReq.ContentType = "application/x-www-form-urlencoded";
            webReq.Accept      = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            webReq.Headers.Set("Accept-Language", "zh-TW");
            webReq.UserAgent = para.UserAgent;
            webReq.Headers.Set("Accept-Encoding", "gzip, deflate");
            //webReq.Host = "www09.eyny.com";
            webReq.KeepAlive = true;
            //將剛剛取得的cookie加上去
            webReq.CookieContainer = para.Cookies;
            webReq.Timeout         = 30000;
            if (para.Timeout != 0)
            {
                webReq.Timeout = para.Timeout;
            }

            //webReq.Proxy = proxy;
            return(GetHtmlSource(webReq, encode));
        }
Example #5
0
        /// <summary>
        /// 取得網頁網始碼
        /// </summary>
        /// <param name="para"></param>
        /// <param name="encode"></param>
        /// <returns></returns>
        public static string PostHtmlSource(DownloadParameter para, System.Text.Encoding encode, string formData)
        {
            //再來建立你要取得的Request
            var webReq = (HttpWebRequest)WebRequest.Create(para.Url);

            webReq.ContentType = "application/x-www-form-urlencoded";
            webReq.Accept      = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            webReq.Headers.Set("Accept-Language", "zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4");
            webReq.UserAgent = para.UserAgent;
            webReq.Headers.Set("Accept-Encoding", "gzip, deflate");
            webReq.Method  = "POST";
            webReq.Timeout = 30000;
            if (para.Timeout != 0)
            {
                webReq.Timeout = para.Timeout;
            }
            byte[] bs = Encoding.ASCII.GetBytes(formData);
            using (Stream reqStream = webReq.GetRequestStream())
            {
                reqStream.Write(bs, 0, bs.Length);
            }

            return(GetHtmlSource(webReq, encode));
        }
Example #6
0
 /// <summary>
 /// 取得網頁網始碼
 /// </summary>
 /// <param name="para"></param>
 /// <param name="encode"></param>
 /// <returns></returns>
 public static string GetHtmlSource(DownloadParameter para, System.Text.Encoding encode)
 {
     return(GetHtmlSource(para, encode, new WebProxy()));
 }
Example #7
0
 /// <summary>
 /// 取得網頁網始碼
 /// </summary>
 /// <param name="para"></param>
 /// <param name="encode"></param>
 /// <returns></returns>
 public static string GetHtmlSource( DownloadParameter para, System.Text.Encoding encode)
 {
     return GetHtmlSource( para, encode, new WebProxy());
 }
Example #8
0
        /// <summary>
        /// 取得網頁網始碼
        /// </summary>
        /// <param name="para"></param>
        /// <param name="encode"></param>
        /// <param name="proxy"></param>
        /// <returns></returns>
        public static string GetHtmlSource(DownloadParameter para, System.Text.Encoding encode, WebProxy proxy)
        {
            //再來建立你要取得的Request
            var webReq = (HttpWebRequest)WebRequest.Create(para.Url);
            webReq.ContentType = "application/x-www-form-urlencoded";
            webReq.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            webReq.Headers.Set("Accept-Language", "zh-TW");
            webReq.UserAgent = para.UserAgent;
            webReq.Headers.Set("Accept-Encoding", "gzip, deflate");
            //webReq.Host = "www09.eyny.com";
            webReq.KeepAlive = true;
            //將剛剛取得的cookie加上去
            webReq.CookieContainer = para.Cookies;
            webReq.Timeout = 30000;
            if (para.Timeout != 0)
            {
                webReq.Timeout = para.Timeout;
            }

            //webReq.Proxy = proxy;
            return GetHtmlSource(webReq, encode);
        }