Exemplo n.º 1
0
        public ChinaUnixService(string un)
        {
            url = "http://blog.chinaunix.net/uid/" + un + "/frmd/-1/page/{0}.html";

            web = new WebUtility();
            web.Encode = Encoding.GetEncoding("gbk");
        }
Exemplo n.º 2
0
        private void Init(bool getList)
        {
            baseDir += _fileName;
            if (Directory.Exists(baseDir))
            {
                Directory.Delete(baseDir, true);
            }
            Directory.CreateDirectory(baseDir);
            baseDir += "\\";

            _callback("正在准备EPUB必须文件");
            Directory.CreateDirectory(baseDir + "META-INF");
            CreateFile(baseDir + "META-INF\\container.xml", strContainer);
            CreateFile(baseDir + "mimetype", strMimetype);
            WebUtility web = new WebUtility();
            web.URL = strCover;
            web.DownloadFile(baseDir + "cover.png");
            CreateFile(baseDir + "stylesheet.css", strStyle);
            CreateFile(baseDir + "titlepage.xhtml", strTitlepage);

            if (getList)
            {
                _callback("正在获取文章列表");
                items = feedService.GetList();
                _callback("共获取到【" + items.Count + "】篇文章");
            }
        }
Exemplo n.º 3
0
        public HexunService(string un)
        {
            url = "http://" + un + ".blog.hexun.com/p{0}/default.html";

            web = new WebUtility();
            web.Encode = Encoding.GetEncoding("gb2312");
        }
Exemplo n.º 4
0
        public SinaService(string un)
        {
            url = "http://photo.blog.sina.com.cn/" + un;

            web = new WebUtility();
            web.URL = url;
            string html = web.Get();
            Match mat = Regex.Match(html, @"(?i)<a href=""(.+?)"">博文目录</a>");
            if (mat.Success)
            {
                url = mat.Groups[1].Value.Replace("_1.html", "_{0}.html");
            }
            else
            {
                throw new Exception("获取博客列表失败");
            }
        }
Exemplo n.º 5
0
        public SohuService(string un)
        {
            url = "http://" + un + ".blog.sohu.com/entry/";

            web = new WebUtility();
            web.URL = url;
            web.Encode = Encoding.GetEncoding("gbk");
            string html = web.Get();
            Match mat = Regex.Match(html, @"var _ebi = '(.+?)';");
            if (mat.Success)
            {
                url = "http://" + un + ".blog.sohu.com/action/v_frag-ebi_" + mat.Groups[1].Value + "-pg_{0}/entry/";
            }
            else
            {
                throw new Exception("获取博客列表失败");
            }
        }
Exemplo n.º 6
0
 public B51CtoService(string un)
 {
     url = "http://" + un + ".blog.51cto.com";
     
     web = new WebUtility();
     web.Encode = Encoding.GetEncoding("gb2312");
     web.URL = url;
     string html = web.Get();
     var m = Regex.Match(html, @"<a href=""/all/(.+?)"" class=""fr"">");
     if (m.Success)
     {
         url += "/all/" + m.Groups[1].Value + "/page/{0}";
     }
     else
     {
         throw new Exception("获取博客列表失败");
     }
 }
Exemplo n.º 7
0
        public B163Service(string un)
        {
            url = "http://blog.163.com/" + un + "/blog/";

            web = new WebUtility();
            web.URL = url;
            string html = web.Get();
            var mat = Regex.Match(html, @"userId:(\d+)");
            if (mat.Success)
            {
                userId = mat.Groups[1].Value;
            }
            else
            {
                throw new Exception("获取博客列表失败");
            }

            url = "http://api.blog.163.com/" + un + "/dwr/call/plaincall/BlogBeanNew.getBlogs.dwr";
        }
Exemplo n.º 8
0
        public CsdnService(string un)
        {
            url = "http://blog.csdn.com/" + un + "/article/list/{0}?viewmode=contents";

            web = new WebUtility();
        }
Exemplo n.º 9
0
        public OschinaService(string un)
        {
            url = "http://my.oschina.net/" + un + "/blog?disp=3&p={0}";

            web = new WebUtility();
        }
Exemplo n.º 10
0
        private string[] GetColumnUrls(string alias)
        {
            IList<string> urls = new List<string>();

            string url = "http://blog.csdn.net/column/details/" + alias + ".html?page={0}";
            int p = 0;
            WebUtility web = new WebUtility();
            web.Encode = Encoding.UTF8;
            for (int i = 1; i < 100; i++)
            {
                if (p > 0 && i > p) break;
                web.URL = string.Format(url, i);
                string html = web.Get();
                if (p == 0)
                {
                    var mp = Regex.Match(html, @"共(\d+)页");
                    if (mp.Success) p = App.ToInt(mp.Groups[1].Value);
                    else p = 1;
                }
                var mats = reg_title.Matches(html);
                if (mats.Count == 0) break;
                foreach (Match mat in mats)
                {
                    urls.Add(mat.Groups[1].Value);
                } 
            }
            string[] ss = new string[urls.Count];
            for (int i = 0; i < urls.Count; i++)
            {
                ss[i] = urls[i];
            }
            return ss;
        }
Exemplo n.º 11
0
        public CnBlogsService(string un)
        {
            url = "http://www.cnblogs.com/" + un + "/default.aspx?page={0}&onlytitle=1";

            web = new WebUtility();
        }
Exemplo n.º 12
0
        public ItEyeService(string un)
        {
            url = "http://" + un + ".iteye.com/?page={0}";

            web = new WebUtility();
        }