예제 #1
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            for (int i = 1; i < 1000; i++)
            {
                web.URL = string.Format(url, i);
                string html = web.Get();
                var    mats = reg_title.Matches(html);
                if (mats.Count == 0)
                {
                    break;
                }
                foreach (Match mat in mats)
                {
                    var fd = new FeedEntity();
                    fd.Url   = "http://blog.chinaunix.net" + mat.Groups[1].Value;
                    fd.Title = mat.Groups[2].Value;

                    if (fd.Title.StartsWith("[转载]"))
                    {
                        fd.Title = fd.Title.Substring(4);
                    }

                    list.Add(fd);
                }
            }
            return(list);
        }
예제 #2
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            int p = 0;

            for (int i = 1; i < 1000; 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
                    {
                        var mps = Regex.Matches(html, @">(\d+)</a><span class='pagesplit'>");
                        if (mps.Count > 0)
                        {
                            p = App.ToInt(mps[mps.Count - 1].Groups[1].Value);
                        }
                        else
                        {
                            p = 1;
                        }
                    }
                }

                var mats = reg_item.Matches(html);
                if (mats.Count == 0)
                {
                    break;
                }
                foreach (Match mat in mats)
                {
                    var m_t = reg_title.Match(mat.Value);
                    var fd  = new FeedEntity();
                    fd.Url   = m_t.Groups[1].Value;
                    fd.Title = m_t.Groups[2].Value;

                    if (fd.Title == "本文被设定为主人好友可见")
                    {
                        continue;
                    }

                    list.Add(fd);
                }
            }
            return(list);
        }
예제 #3
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            int p = 0;

            for (int i = 1; i < 1000; 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, @"<a href=""/\?page=(\d+)""[^>]*>[^<]+?</a> <a href=""/\?page=2"" class=""next_page""");
                    if (mp.Success)
                    {
                        p = App.ToInt(mp.Groups[1].Value);
                    }
                    else
                    {
                        p = 1;
                    }
                }
                var mats = reg_item.Matches(html);
                if (mats.Count == 0)
                {
                    break;
                }
                foreach (Match mat in mats)
                {
                    Match m_t = reg_title.Match(mat.Value);
                    if (!m_t.Success)
                    {
                        continue;
                    }

                    var fd = new FeedEntity();
                    fd.Url   = url.Split('?')[0] + m_t.Groups[1].Value.TrimStart('/');
                    fd.Title = m_t.Groups[2].Value;

                    list.Add(fd);
                }
                System.Threading.Thread.Sleep(1000);
            }
            return(list);
        }
예제 #4
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            int p = 0;

            for (int i = 1; i < 1000; 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)
                {
                    var fd = new FeedEntity();
                    fd.Url   = mat.Groups[1].Value;
                    fd.Title = mat.Groups[2].Value;

                    if (fd.Title.StartsWith("[转载]"))
                    {
                        fd.Title = fd.Title.Substring(4);
                    }

                    list.Add(fd);
                }
            }
            return(list);
        }
예제 #5
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            int p = 0;

            for (int i = 1; i < 1000; 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, @"页数 \( 1/(\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)
                {
                    var fd = new FeedEntity();
                    fd.Url   = "http://" + url.Split('/')[2] + mat.Groups[2].Value;
                    fd.Title = mat.Groups[3].Value;

                    list.Add(fd);
                }
            }
            return(list);
        }
예제 #6
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            for (int i = 1; i < 1000; i++)
            {
                web.URL = string.Format(url, i);
                string html = web.Get();
                var    mats = reg_title.Matches(html);
                if (mats.Count == 0)
                {
                    break;
                }
                foreach (Match mat in mats)
                {
                    var fd = new FeedEntity();
                    fd.Url   = mat.Groups[1].Value;
                    fd.Title = mat.Groups[2].Value;

                    list.Add(fd);
                }
            }
            return(list);
        }
예제 #7
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);
        }
예제 #8
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("获取博客列表失败");
            }
        }
예제 #9
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("获取博客列表失败");
     }
 }
예제 #10
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("获取博客列表失败");
            }
        }
예제 #11
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("获取博客列表失败");
            }
        }
예제 #12
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("获取博客列表失败");
            }
        }
예제 #13
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("获取博客列表失败");
            }
        }
예제 #14
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";
        }
예제 #15
0
        public FeedEntity GetEntity(string url)
        {
            var entity = new FeedEntity();

            web.URL = url;
            string html = web.Get();
            Match  mat  = reg_title2.Match(html);

            if (mat.Success)
            {
                entity.Title = mat.Groups[1].Value.Trim();
            }
            mat = reg_con2.Match(html);
            if (mat.Success)
            {
                entity.Content = mat.Groups[1].Value.Trim();
            }
            return(entity);
        }
예제 #16
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";
        }
예제 #17
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;
        }
예제 #18
0
        public IList <FeedEntity> GetList()
        {
            var list = new List <FeedEntity>();

            int p = 0;

            for (int i = 1; i < 1000; 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)
                {
                    var fd = new FeedEntity();
                    fd.Url   = mat.Groups[1].Value.Split('#')[0].Split('?')[0].ToLower();
                    fd.Title = mat.Groups[3].Value;
                    if (fd.Url.Split('/')[3] != url.Split('/')[3])
                    {
                        continue;
                    }
                    if (fd.Title.StartsWith("[转]"))
                    {
                        fd.Title = fd.Title.Substring(3);
                    }
                    bool has = false;
                    foreach (var fe in list)
                    {
                        if (fe.Url == fd.Url || fe.Title == fd.Title)
                        {
                            has = true;
                            break;
                        }
                    }
                    if (has)
                    {
                        continue;
                    }

                    list.Add(fd);
                }
            }
            return(list);
        }