简体   繁体   中英

Flickr API + JAVA - flickrj

I want to download a set of photos of a particular user in Flickr using the Flickr Java API (flickrj)

Does anybody knows how to do it?

I've stated with this code:

Transport t = new REST();
Flickr f = new Flickr(key, secret, t);
User u = f.getPeopleInterface().findByUsername("username");

What should I do next?

I found the answer before someone could help me.

here's the code:

Transport t = new REST();
Flickr f = new Flickr("key", "secret", t);
PhotoList list = f.getPhotosetsInterface().getPhotos("setId", 100, 1);
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
    Photo photo = (Photo) iterator.next();
    File file = new File("/tmp/" + photo.getId() + ".jpg");
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    b.write(photo.getOriginalAsStream());
    FileUtils.writeByteArrayToFile(file, b.toByteArray());
}   

要为Flickr构建Android应用,您还可以查看我的库: http//code.google.com/p/flickrj-android/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM