Esempio n. 1
0
        /// <summary>
        /// 获取当前登录用户的站内信(收件箱、发件箱)
        /// </summary>
        /// <param name="inbox"></param>
        /// <param name="page_index"></param>
        /// <returns></returns>
        public async static Task <List <CNMessage> > GetCurrentUserMessage(bool inbox, int page_index)
        {
            try
            {
                string url = inbox ? _url_inbox_messages : _url_outbox_messages;
                url = string.Format(url, page_index) + "?t=" + DateTime.Now.Millisecond;
                string html = await BaseService.SendGetRequest(url);

                if (html != null)
                {
                    html = html.Split(new string[] { "<tbody>" }, StringSplitOptions.None)[1]
                           .Split(new string[] { "</tbody>" }, StringSplitOptions.None)[0];
                    html = "<?xml version =\"1.0\" encoding=\"utf - 8\" ?> " + "<result>" + html.Replace("type=\"checkbox\">", "type=\"checkbox\"/>") + "</result>";

                    List <CNMessage> list_messages = new List <CNMessage>();
                    CNMessage        msg;
                    XmlDocument      doc = new XmlDocument();
                    doc.LoadXml(html);

                    XmlNode result = doc.ChildNodes[1];
                    foreach (XmlNode node in result.ChildNodes)
                    {
                        msg = new CNMessage();
                        if (inbox)
                        {
                            msg.Inbox    = inbox;
                            msg.FromOrTo = node.ChildNodes[0].InnerText.Trim();
                            msg.Title    = node.ChildNodes[1].InnerText.Trim();
                            msg.ID       = node.ChildNodes[1].ChildNodes[0].Attributes["href"].Value.Split('/')[3];
                            msg.AuthorID = node.ChildNodes[0].ChildNodes[0].Attributes["href"].Value.Split('/')[4];
                        }
                        else
                        {
                            msg.Inbox    = inbox;
                            msg.FromOrTo = node.ChildNodes[1].InnerText.Trim();
                            msg.Title    = node.ChildNodes[2].InnerText.Trim();
                            msg.ID       = node.ChildNodes[2].ChildNodes[0].Attributes["href"].Value.Split('/')[3];
                            msg.AuthorID = node.ChildNodes[1].ChildNodes[0].Attributes["href"].Value.Split('/')[4];
                        }

                        list_messages.Add(msg);
                    }

                    return(list_messages);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 2
0
        public async static Task <List <CNCollection> > GetCurrentUserCollection(int page_index)
        {
            try
            {
                string url  = string.Format(_url_collections, page_index) + "?t=" + DateTime.Now.Millisecond;
                string html = await BaseService.SendGetRequest(url);

                if (html != null)
                {
                    List <CNCollection> list_collections = new List <CNCollection>();
                    CNCollection        collection;

                    html = html.Split(new string[] { "<div id=\"main\">" }, StringSplitOptions.None)[2]
                           .Split(new string[] { "<div id=\"right_sidebar\">" }, StringSplitOptions.None)[0];

                    html = "<?xml version =\"1.0\" encoding=\"utf - 8\" ?> " + "<div><div>" + html.Replace(")\">", ")\"/>").Replace("&nbsp;", "");

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(html);

                    XmlNode result = doc.ChildNodes[1].ChildNodes[0].ChildNodes[0].ChildNodes[0];
                    foreach (XmlNode node in result.ChildNodes)
                    {
                        collection       = new CNCollection();
                        collection.Title = node.ChildNodes[0].ChildNodes[1].ChildNodes[0].InnerText.Trim();
                        if (node.ChildNodes[0].ChildNodes[1].ChildNodes[1].ChildNodes.Count == 2)
                        {
                            collection.Summary = node.ChildNodes[0].ChildNodes[1].ChildNodes[1].ChildNodes[0].InnerText;
                            collection.RawUrl  = node.ChildNodes[0].ChildNodes[1].ChildNodes[1].ChildNodes[1].InnerText;
                        }
                        else
                        {
                            collection.Summary = "";
                            collection.RawUrl  = node.ChildNodes[0].ChildNodes[1].ChildNodes[1].ChildNodes[0].InnerText;
                        }
                        collection.CollectionTime  = "收藏于 " + node.ChildNodes[0].ChildNodes[1].ChildNodes[2].ChildNodes[1].InnerText;
                        collection.CollectionCount = node.ChildNodes[0].ChildNodes[1].ChildNodes[2].ChildNodes[2].InnerText + "次";
                        collection.Category        = "标签 " + node.ChildNodes[0].ChildNodes[1].ChildNodes[2].ChildNodes[4].ChildNodes[0].InnerText;

                        list_collections.Add(collection);
                    }
                    return(list_collections);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取站内信具体内容
        /// </summary>
        /// <param name="msg_id"></param>
        /// <returns></returns>
        public async static Task <List <CNMessageItem> > GetMessageItems(string msg_id)
        {
            try
            {
                string url  = string.Format(_url_messages_items, msg_id) + "?t=" + DateTime.Now.Millisecond;
                string html = await BaseService.SendGetRequest(url);

                if (html != null)
                {
                    html = html.Split(new string[] { "<ul class=\"bubble-wrap\">" }, StringSplitOptions.None)[1]
                           .Split(new string[] { "</ul>" }, StringSplitOptions.None)[0];

                    html = "<?xml version =\"1.0\" encoding=\"utf - 8\" ?> " + "<result>" + html.Replace("<br>", "") + "</result>";

                    List <CNMessageItem> list_items = new List <CNMessageItem>();
                    CNMessageItem        item;

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(html);

                    XmlNode result = doc.ChildNodes[1];

                    foreach (XmlNode node in result.ChildNodes)
                    {
                        item = new CNMessageItem();

                        item.AuthorAvatar = node.ChildNodes[0].ChildNodes[0].Attributes["src"].Value;
                        item.AuthorHome   = node.ChildNodes[0].Attributes["href"].Value;
                        item.AuthorName   = node.ChildNodes[0].Attributes["title"].Value;
                        item.MsgID        = msg_id;
                        item.Send         = node.ChildNodes[0].Attributes["class"] == null ? false : true; //发送者有样式
                        item.Time         = node.ChildNodes[1].InnerText;
                        item.Content      = node.ChildNodes[2].ChildNodes[0].InnerText;

                        list_items.Add(item);
                    }
                    return(list_items);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取指定用户的关注
        /// </summary>
        /// <param name="blog_app"></param>
        /// <param name="page_index"></param>
        /// <returns></returns>
        public async static Task <List <CNUserInfo> > GetFollowees(string blog_app, int page_index)
        {
            try
            {
                string url  = string.Format(_url_user_followees, blog_app, page_index) + "?t=" + DateTime.Now.Millisecond;
                string html = await BaseService.SendGetRequest(url);

                if (html != null)
                {
                    List <CNUserInfo> list_followees = new List <CNUserInfo>();
                    CNUserInfo        user;

                    html = html.Split(new string[] { "<div class=\"avatar_list\">" }, StringSplitOptions.None)[1]
                           .Split(new string[] { "<div class=\"clear\"></div>" }, StringSplitOptions.None)[0];
                    html = "<div>" + html.Replace("&amp;", "").Replace("&", "");

                    html = "<?xml version =\"1.0\" encoding=\"utf - 8\" ?> " + html.Replace("\"></a>", "\"/></a>");

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(html);

                    XmlNode ul = doc.ChildNodes[1].ChildNodes[0];

                    foreach (XmlNode node in ul.ChildNodes)
                    {
                        user = new CNUserInfo();

                        user.Avatar  = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].Attributes["src"].Value;
                        user.Name    = node.ChildNodes[1].ChildNodes[0].InnerText;
                        user.BlogApp = node.ChildNodes[1].ChildNodes[0].Attributes["href"].Value.Split('/')[2];

                        list_followees.Add(user);
                    }

                    return(list_followees);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 5
0
        static string _url_search_blogs  = "http://zzk.cnblogs.com/s?w={0}&t=b&p={1}";               //blog_keywords page_index

        /// <summary>
        /// 搜索博客
        /// </summary>
        /// <param name="keywords"></param>
        /// <param name="page_index"></param>
        /// <returns></returns>
        public async static Task <List <CNBlog> > SearchBlogs(string keywords, int page_index)
        {
            try
            {
                string url  = string.Format(_url_search_blogs, keywords, page_index);
                string html = await BaseService.SendGetRequest(url);

                if (html != null)
                {
                    html = html.Split(new string[] { "<div class=\"forflow\">" }, StringSplitOptions.None)[1]
                           .Split(new string[] { "<div class=\"forflow\" id=\"sidebar\">" }, StringSplitOptions.None)[0]
                           .Split(new string[] { "<div id=\"paging_block\"" }, StringSplitOptions.None)[0];
                    html = "<?xml version=\"1.0\" encoding=\"utf - 8\" ?> " + "<result>" + html + "</result>";
                    List <CNBlog> list_blogs = new List <CNBlog>();
                    CNBlog        blog;

                    XmlDocument doc = new XmlDocument();

                    doc.LoadXml(html);

                    XmlNode search_items = doc.ChildNodes[1];
                    if (search_items != null)
                    {
                        foreach (XmlNode node in search_items.ChildNodes)
                        {
                            blog             = new CNBlog();
                            blog.Title       = node.ChildNodes[0].InnerText;
                            blog.Summary     = node.ChildNodes[2].InnerText;
                            blog.AuthorName  = node.ChildNodes[4].ChildNodes[0].InnerText;
                            blog.AuthorHome  = node.ChildNodes[4].ChildNodes[0].ChildNodes[0].Attributes["href"].Value;
                            blog.BlogApp     = blog.AuthorHome.Split('/')[3];
                            blog.PublishTime = node.ChildNodes[4].ChildNodes[1].InnerText;
                            if (node.ChildNodes[4].ChildNodes[2] != null)
                            {
                                if (node.ChildNodes[4].ChildNodes[2].InnerText.Contains("推荐"))
                                {
                                    blog.Diggs = node.ChildNodes[4].ChildNodes[2].InnerText.Split('(')[1].TrimEnd(')');
                                }
                                if (node.ChildNodes[4].ChildNodes[2].InnerText.Contains("评论"))
                                {
                                    blog.Comments = "[" + node.ChildNodes[4].ChildNodes[2].InnerText.Split('(')[1].TrimEnd(')') + "]";
                                }
                                if (node.ChildNodes[4].ChildNodes[2].InnerText.Contains("浏览"))
                                {
                                    blog.Views = "[" + node.ChildNodes[4].ChildNodes[2].InnerText.Split('(')[1].TrimEnd(')') + "]";
                                }
                            }
                            if (node.ChildNodes[4].ChildNodes[3] != null)
                            {
                                if (node.ChildNodes[4].ChildNodes[3].InnerText.Contains("推荐"))
                                {
                                    blog.Diggs = node.ChildNodes[4].ChildNodes[3].InnerText.Split('(')[1].TrimEnd(')');
                                }
                                if (node.ChildNodes[4].ChildNodes[3].InnerText.Contains("评论"))
                                {
                                    blog.Comments = "[" + node.ChildNodes[4].ChildNodes[3].InnerText.Split('(')[1].TrimEnd(')') + "]";
                                }
                                if (node.ChildNodes[4].ChildNodes[3].InnerText.Contains("浏览"))
                                {
                                    blog.Views = "[" + node.ChildNodes[4].ChildNodes[3].InnerText.Split('(')[1].TrimEnd(')') + "]";
                                }
                            }
                            if (node.ChildNodes[4].ChildNodes[4] != null)
                            {
                                if (node.ChildNodes[4].ChildNodes[4].InnerText.Contains("推荐"))
                                {
                                    blog.Diggs = node.ChildNodes[4].ChildNodes[4].InnerText.Split('(')[1].TrimEnd(')');
                                }
                                if (node.ChildNodes[4].ChildNodes[4].InnerText.Contains("评论"))
                                {
                                    blog.Comments = "[" + node.ChildNodes[4].ChildNodes[4].InnerText.Split('(')[1].TrimEnd(')') + "]";
                                }
                                if (node.ChildNodes[4].ChildNodes[4].InnerText.Contains("浏览"))
                                {
                                    blog.Views = "[" + node.ChildNodes[4].ChildNodes[4].InnerText.Split('(')[1].TrimEnd(')') + "]";
                                }
                            }
                            blog.BlogRawUrl   = node.ChildNodes[5].InnerText;
                            blog.AuthorAvator = "http://pic.cnblogs.com/avatar/simple_avatar.gif";

                            string[] strs = blog.BlogRawUrl.Split('/');
                            blog.ID = strs[strs.Length - 1].Split('.')[0];

                            if (blog.Diggs == null)
                            {
                                blog.Diggs = "0";
                            }
                            if (blog.Comments == null)
                            {
                                blog.Comments = "[0]";
                            }
                            list_blogs.Add(blog);
                        }
                    }
                    return(list_blogs);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 搜索博主
        /// </summary>
        /// <param name="keywords"></param>
        /// <returns></returns>
        public async static Task <List <CNBloger> > SearchBloger(string keywords)
        {
            try
            {
                string url = string.Format(_url_search_bloger, keywords);
                string xml = await BaseService.SendGetRequest(url);

                if (xml != null)
                {
                    List <CNBloger> list_bloger = new List <CNBloger>();
                    CNBloger        bloger;

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);

                    XmlNode feed = doc.ChildNodes[1];

                    foreach (XmlNode node in feed.ChildNodes)
                    {
                        if (node.Name.Equals("entry"))
                        {
                            bloger = new CNBloger();
                            foreach (XmlNode node2 in node.ChildNodes)
                            {
                                if (node2.Name.Equals("id"))
                                {
                                    bloger.BlogerHome = node2.InnerText;
                                }
                                if (node2.Name.Equals("title"))
                                {
                                    bloger.BlogerName = node2.InnerText;
                                }
                                if (node2.Name.Equals("updated"))
                                {
                                    DateTime t = DateTime.Parse(node2.InnerText);
                                    bloger.UpdateTime = "最后更新 " + t.ToString();
                                }
                                if (node2.Name.Equals("blogapp"))
                                {
                                    bloger.BlogApp = node2.InnerText;
                                }
                                if (node2.Name.Equals("avatar"))
                                {
                                    bloger.BlogerAvator = node2.InnerText.Equals("") ? "http://pic.cnblogs.com/avatar/simple_avatar.gif" : node2.InnerText;
                                }
                                if (node2.Name.Equals("postcount"))
                                {
                                    bloger.PostCount = "发表博客 " + node2.InnerText + "篇";
                                }
                            }
                            list_bloger.Add(bloger);
                        }
                    }
                    return(list_bloger);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 7
0
        /// 获取指定用户信息
        public async static Task <CNUserInfo> GetUserInfo(string blog_app)
        {
            try
            {
                string url  = string.Format(_url_user_info, blog_app);
                string html = await BaseService.SendGetRequest(url);

                if (html != null)
                {
                    CNUserInfo user = new CNUserInfo();

                    user.GUID = html.Split(new string[] { "var currentUserId = " }, StringSplitOptions.None)[1]
                                .Split(new string[] { "var isLogined = true;" }, StringSplitOptions.None)[0].Trim().Trim(';');

                    string avatar = html.Split(new string[] { "<div class=\"user_avatar\">" }, StringSplitOptions.None)[1]
                                    .Split(new string[] { "class=\"img_avatar\">" }, StringSplitOptions.None)[0]
                                    .Split(new string[] { "src=\"" }, StringSplitOptions.None)[1]
                                    .Split(new string[] { "\" alt=" }, StringSplitOptions.None)[0];

                    user.Avatar = avatar;

                    html = html.Split(new string[] { "<td valign=\"top\">" }, StringSplitOptions.None)[2]
                           .Split(new string[] { "<div class=\"user_intro\">" }, StringSplitOptions.None)[0]
                           .Split(new string[] { "<br>" }, StringSplitOptions.None)[0];

                    html = "<?xml version =\"1.0\" encoding=\"utf - 8\" ?> " + "<result>" + html + "</result>";

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(html);

                    user.Name = doc.ChildNodes[1].ChildNodes[0].ChildNodes[0].InnerText.Trim();
                    XmlNodeList lis = doc.GetElementsByTagName("li");
                    foreach (XmlNode n in lis)
                    {
                        if (n.ChildNodes.Count == 2)
                        {
                            if (n.ChildNodes[0].InnerText.Contains("园龄"))
                            {
                                user.Age = "园龄 " + n.ChildNodes[1].InnerText;
                            }
                            if (n.ChildNodes[0].InnerText.Contains("博客"))
                            {
                                user.BlogHome = n.ChildNodes[1].InnerText;
                            }
                        }
                    }

                    user.BlogApp = user.BlogHome.Split('/')[3];

                    return(user);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 8
0
        static string _url_news_comment   = "http://wcf.open.cnblogs.com/news/item/{0}/comments/{1}/{2}"; //news_id page_index page_size

        /// <summary>
        /// 获取首页新闻
        /// </summary>
        /// <param name="page_index"></param>
        /// <param name="page_size"></param>
        /// <returns></returns>
        public async static Task <List <CNNews> > GetRecentNewsAsync(int page_index, int page_size)
        {
            try
            {
                string url = string.Format(_url_recent_news, page_index, page_size);
                string xml = await BaseService.SendGetRequest(url);

                if (xml != null)
                {
                    List <CNNews> list_news = new List <CNNews>();
                    CNNews        news;

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);

                    XmlNode feed = doc.ChildNodes[1];

                    foreach (XmlNode node in feed.ChildNodes)
                    {
                        if (node.Name.Equals("entry"))
                        {
                            news = new CNNews();
                            foreach (XmlNode node2 in node.ChildNodes)
                            {
                                if (node2.Name.Equals("id"))
                                {
                                    news.ID = node2.InnerText;
                                }
                                if (node2.Name.Equals("title"))
                                {
                                    news.Title = node2.InnerText;
                                }
                                if (node2.Name.Equals("summary"))
                                {
                                    news.Summary = node2.InnerText;
                                }
                                if (node2.Name.Equals("published"))
                                {
                                    DateTime t = DateTime.Parse(node2.InnerText);
                                    news.PublishTime = t.ToString();
                                }
                                if (node2.Name.Equals("updated"))
                                {
                                    news.UpdateTime = node2.InnerText;
                                }
                                if (node2.Name.Equals("link"))
                                {
                                    news.NewsRawUrl = node2.Attributes["href"].Value;
                                }
                                if (node2.Name.Equals("diggs"))
                                {
                                    news.Diggs = node2.InnerText;
                                }
                                if (node2.Name.Equals("views"))
                                {
                                    news.Views = node2.InnerText;
                                }
                                if (node2.Name.Equals("comments"))
                                {
                                    news.Comments = node2.InnerText;
                                }
                                if (node2.Name.Equals("topic"))
                                {
                                    if (node2.HasChildNodes)
                                    {
                                        news.TopicName = node2.InnerText;
                                    }
                                    else
                                    {
                                        news.TopicName = "";
                                    }
                                }
                                if (node2.Name.Equals("topicIcon"))
                                {
                                    if (node2.HasChildNodes)
                                    {
                                        news.TopicIcon = node2.InnerText;
                                    }
                                    else
                                    {
                                        news.TopicIcon = "http://static.cnblogs.com/images/logo_small.gif";
                                    }
                                }
                                if (node2.Name.Equals("sourceName"))
                                {
                                    news.SourceName = node2.InnerText;
                                }
                            }
                            list_news.Add(news);
                        }
                    }
                    return(list_news);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 获取指定新闻评论
        /// </summary>
        /// <param name="news_id"></param>
        /// <param name="page_index"></param>
        /// <param name="page_size"></param>
        /// <returns></returns>
        public async static Task <List <CNNewsComment> > GetNewsCommentsAysnc(string news_id, int page_index, int page_size)
        {
            try
            {
                string url = string.Format(_url_news_comment, news_id, page_index, page_size);
                string xml = await BaseService.SendGetRequest(url);

                if (xml != null)
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);

                    List <CNNewsComment> list_comments = new List <CNNewsComment>();
                    CNNewsComment        comment;
                    XmlNode feed = doc.ChildNodes[1];

                    foreach (XmlNode node in feed.ChildNodes)
                    {
                        if (node.Name.Equals("entry"))
                        {
                            comment = new CNNewsComment();
                            foreach (XmlNode node2 in node.ChildNodes)
                            {
                                if (node2.Name.Equals("id"))
                                {
                                    comment.ID = node2.InnerText;
                                }
                                if (node2.Name.Equals("published"))
                                {
                                    DateTime t = DateTime.Parse(node2.InnerText);
                                    comment.PublishTime = t.ToString();
                                }
                                if (node2.Name.Equals("updated"))
                                {
                                    comment.UpdateTime = node2.InnerText;
                                }
                                if (node2.Name.Equals("author"))
                                {
                                    comment.AuthorName   = node2.ChildNodes[0].InnerText;
                                    comment.AuthorHome   = node2.ChildNodes[1].InnerText;
                                    comment.AuthorAvatar = "http://pic.cnblogs.com/avatar/simple_avatar.gif";  //api中没有头像url
                                }
                                if (node2.Name.Equals("content"))
                                {
                                    comment.Content = node2.InnerText;
                                }
                            }
                            list_comments.Add(comment);
                        }
                    }
                    return(list_comments);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 十天推荐榜
        /// </summary>
        /// <param name="item_count"></param>
        /// <returns></returns>
        public async static Task <List <CNBlog> > Get10TopDiggsAysnc(int item_count)
        {
            try
            {
                string url = string.Format(_url_10_diggs, item_count);
                string xml = await BaseService.SendGetRequest(url);

                if (xml != null)
                {
                    List <CNBlog> list_blogs = new List <CNBlog>();
                    CNBlog        cnblog;
                    XmlDocument   doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlNode feed = doc.ChildNodes[1];
                    foreach (XmlNode node in feed.ChildNodes)
                    {
                        if (node.Name.Equals("entry"))
                        {
                            cnblog = new CNBlog();
                            foreach (XmlNode node2 in node.ChildNodes)
                            {
                                if (node2.Name.Equals("id"))
                                {
                                    cnblog.ID = node2.InnerText;
                                }
                                if (node2.Name.Equals("title"))
                                {
                                    cnblog.Title = node2.InnerText;
                                }
                                if (node2.Name.Equals("summary"))
                                {
                                    cnblog.Summary = node2.InnerText + "...";
                                }
                                if (node2.Name.Equals("published"))
                                {
                                    DateTime t = DateTime.Parse(node2.InnerText);
                                    cnblog.PublishTime = "发表于 " + t.ToString();
                                }
                                if (node2.Name.Equals("updated"))
                                {
                                    cnblog.UpdateTime = node2.InnerText;
                                }
                                if (node2.Name.Equals("author"))
                                {
                                    cnblog.AuthorName = node2.ChildNodes[0].InnerText;
                                    cnblog.AuthorHome = node2.ChildNodes[1].InnerText;
                                    if (node2.ChildNodes.Count == 3)
                                    {
                                        cnblog.AuthorAvator = node2.ChildNodes[2].InnerText.Equals("") ? "http://pic.cnblogs.com/avatar/simple_avatar.gif" : node2.ChildNodes[2].InnerText;
                                    }
                                    else
                                    {
                                        cnblog.AuthorAvator = "http://pic.cnblogs.com/avatar/simple_avatar.gif";
                                    }
                                }
                                if (node2.Name.Equals("link"))
                                {
                                    cnblog.BlogRawUrl = node2.Attributes["href"].Value;
                                }
                                if (node2.Name.Equals("diggs"))
                                {
                                    cnblog.Diggs = node2.InnerText;
                                }
                                if (node2.Name.Equals("views"))
                                {
                                    cnblog.Views = "[" + node2.InnerText + "]";
                                }
                                if (node2.Name.Equals("comments"))
                                {
                                    cnblog.Comments = "[" + node2.InnerText + "]";
                                }
                            }
                            cnblog.BlogApp = cnblog.AuthorHome.Split('/')[3];
                            list_blogs.Add(cnblog);
                        }
                    }
                    return(list_blogs);
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                return(null);
            }
        }