Android 博客园客户端 (五) 查看评论、搜索博主

项目地址:https://github.com/ZhangTingkuo/AndroidCnblogs

1.查看评论

// 获取文章评论
    public static final String BLOGS_COMMENTS = "http://wcf.open.cnblogs.com/blog/post/{POSTID}/comments/{PAGEINDEX}/{PAGESIZE}";
// 获取新闻评论
    public static final String NEWS_COMMENTS = http://wcf.open.cnblogs.com/news/item/{CONTENTID}/comments/{PAGEINDEX}/{PAGESIZE};
<entry>
<id>2651327</id>
<title type="text"/>
<published>2013-04-07T18:06:24+08:00</published>
<updated>2014-09-10T15:14:10Z</updated>
<author>
<name>松下裤腰带</name>
<uri>http://home.cnblogs.com/u/360988/</uri>
</author>
<content type="text">这好蛋疼呀。。。</content>
</entry>

<entry>
<id>2652650</id>
<title type="text"/>
<published>2013-04-09T09:56:48+08:00</published>
<updated>2014-09-10T15:14:10Z</updated>
<author>
<name>john23.net</name>
<uri>http://home.cnblogs.com/u/64521/</uri>
</author>
<content type="text">感谢分享</content>
</entry>

 

2.搜索博主

搜索博主,如果输入中文的话,需要进行转码.英文的话,转码前后没有区别。

1 http://wcf.open.cnblogs.com/blog/bloggers/search?t={TERM}
2 若。只如初见
3 http://wcf.open.cnblogs.com/blog/bloggers/search?t=%E8%8B%A5%E3%80%82%E5%8F%AA%E5%A6%82%E5%88%9D%E8%A7%81

 

            try {
                authorName = URLEncoder.encode(authorName, "utf-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            path = path.replace("{TERM}", authorName);

 XML的格式跟推荐博主的XML格式相同,所以不需要再重新写Handler和Adapter.直接使用之前的就可以

 1 <entry>
 2 <id>http://www.cnblogs.com/jillzhang/</id>
 3 <title type="text">Robin Zhang</title>
 4 <updated>2012-04-04T19:30:55+08:00</updated>
 5 <link rel="alternate" href="http://www.cnblogs.com/jillzhang/"/>
 6 <blogapp>jillzhang</blogapp>
 7 <avatar>http://pic.cnblogs.com/face/12311/20140902133806.png</avatar>
 8 <postcount>290</postcount>
 9 </entry>
10 
11 <entry>
12 <id>http://www.cnblogs.com/JimmyZhang/</id>
13 <title type="text">Jimmy Zhang</title>
14 <updated>2014-09-10T11:15:32+08:00</updated>
15 <link rel="alternate" href="http://www.cnblogs.com/JimmyZhang/"/>
16 <blogapp>JimmyZhang</blogapp>
17 <avatar>http://pic.cnblogs.com/face/u24804.jpg?id=30073100</avatar>
18 <postcount>83</postcount>
19 </entry>

posted @ 2014-09-11 15:44  若。只如初见  阅读(1533)  评论(2编辑  收藏  举报