Flickr API JAVA – flickrj
•
Java
I want to use Flickr Java API (flickrj) to download a group of photos of specific users in Flickr
Does anyone know how to do it?
I use this code to say:
Transport t = new REST(); Flickr f = new Flickr(key,secret,t); User u = f.getPeopleInterface().findByUsername("username");
What should I do next?
Solution
I found the answer before someone could help me
This is 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()); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码