blogger api blogger客户端 blogger开发
// 初始整个blog,并返回labels
ListgetBlogs() throws ServiceException, IOException {
if (labels == null) {
if (bloggerService == null) {
bloggerLogin();
}
labels = new LinkedList();
// Request the feed
final URL feedUrl = new URL(BLOGGER_API);
Feed resultFeed = bloggerService.getFeed(feedUrl, Feed.class);
blogTitle = resultFeed.getTitle().getPlainText();
//System.out.println(blogTitle);
blogId = resultFeed.getEntries().get(0).getId().split("blog-")[1];
//System.out.println(blogId);
Iteratorit = null;
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
Entry entry = resultFeed.getEntries().get(i);
it = entry.getCategories().iterator();
for (; it.hasNext();) {
Category cat = it.next();
labels.add(cat.getTerm());
// System.out.println(cat.getTerm());
}
}
postUrl = new URL("http://www.blogger.com/feeds/" + blogId
+ "/posts/default");
}
return labels;
}
// 取得所有相册, Map
MapgetAlbums() throws IOException, ServiceException {
if (albums == null) {
if (picasaService == null) {
picasaLogin();
}
albums = new HashMap();
// String albumUrl =
// PICASA_API.concat(this.username).concat("?kind=album");
UserFeed userFeed = picasaService.getFeed(albumUrl, UserFeed.class);
// System.out.println(userFeed.getTitle().getPlainText());
Listentries = userFeed.getEntries();
for (GphotoEntry entry : entries) {
GphotoEntry adapted = entry.getAdaptedEntry();
if (adapted instanceof AlbumEntry) {
AlbumEntry ae = (AlbumEntry) adapted;
albums.put(ae.getTitle().getPlainText(), ae.getGphotoId());
// System.out.println(ae.getGphotoId() + " " + ae.getName()
// + " " + ae.getTitle().getPlainText());
}
}
this.QoteLimited = userFeed.getQuotaLimit();
this.QoteUsed = userFeed.getQuotaUsed();
// 计算相册的使用量
}
return albums;
}
相关文章:
Blogger Api 的简单应用(1)
Blogger Api 的简单应用(3)
Blogger Api 的简单应用(4)
测试我写的blogger客户端的发贴
Blogger客户端myblogger下载
Labels:
Trackback: http://cwq.iou1314.com/_a150
Trackback: http://cwq.iou1314.com/_a150




















