項目地址:https://github.com/ZhangTingkuo/AndroidCnblogs 1.查看評論 // 獲取文章評論 public static final String BLOGS_COMMENTS = "http://wcf.open.cnblogs.com/blog/pos ...
項目地址: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>