public FlickrPhotosExporter(AppCredentials appCredentials) { this.flickr = new Flickr(appCredentials.getKey(), appCredentials.getSecret(), new REST()); this.photosetsInterface = flickr.getPhotosetsInterface(); this.photosInterface = flickr.getPhotosInterface(); }
public FlickrPhotosImporter(AppCredentials appCredentials, JobStore jobStore) { this.jobStore = jobStore; this.flickr = new Flickr(appCredentials.getKey(), appCredentials.getSecret(), new REST()); this.uploader = flickr.getUploader(); this.imageStreamProvider = new ImageStreamProvider(); this.photosetsInterface = flickr.getPhotosetsInterface(); }
import java.util.Collections; import com.flickr4java.flickr.Flickr; import com.flickr4java.flickr.REST; import com.flickr4java.flickr.collections.Collection; import com.flickr4java.flickr.test.TestInterface; public class hello { public static void main(String args[]){ String apiKey = "3f7046fe0897516df587cc3e6226f878"; String sharedSecret = "9d0ceef5f2f3040f"; Flickr f = new Flickr(apiKey, sharedSecret, new REST()); TestInterface testInterface = f.getTestInterface(); java.util.Collection<Element> results = testInterface.echo(Collections.EMPTY_MAP); } }
private static Flickr makeFlickr(FlickrAPIToken token) throws ParserConfigurationException { return new Flickr(token.apikey, token.secret, new REST()); } }
private static Flickr makeFlickr(FlickrAPIToken token) throws ParserConfigurationException { return new Flickr(token.apikey, token.secret, new REST()); } }
/** * Construct an Uploader. * * @param apiKey * The API key */ public Uploader(String apiKey, String sharedSecret) { this(apiKey, sharedSecret, new REST(Transport.UPLOAD_API_HOST)); this.transport.setResponseClass(UploaderResponse.class); }
private void setUpFlickr() { try { Flickr flickr = new Flickr(flickrApiKey, flickrSecret, new REST()); flickrConnection = flickr.getPhotosInterface(); } catch (ParserConfigurationException e) { e.printStackTrace(); //Proper error handling goes here } }
/** * Construct an Uploader. * * @param apiKey * The API key */ public Uploader(String apiKey, String sharedSecret) { this(apiKey, sharedSecret, new REST(Transport.UPLOAD_API_HOST)); this.transport.setResponseClass(UploaderResponse.class); }
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 flickr = new Flickr(API_KEY,SHARED_SECRET,new REST()); Set<String> extras = new HashSet(); // A set of extra info we want Flickr to give back. Go to the API page to see the other size options available. extras.add("url_o"); extras.add("original_format"); //A request for a list of the photos in a set. The first zero is the privacy filter, // the second is the Pages, and the third is the Per-Page (see the Flickr API) PhotoList<Photo> photoList = flickr.getPhotosetsInterface().getPhotos(PHOTOSET_ID, extras, 0, 0, 0); //We'll use the direct URL to the original size of the photo in order to download it. Remember: you want to make as few requests from flickr as possible! for(Photo photo : photoList){ //You can also get other sizes. Just ask for the info in the first request. URL url = new URL(photo.getOriginalSize().getSource()); InputStream is = url.openStream(); OutputStream os = new FileOutputStream(PATH_OF_FOLDER + photo.getTitle() + "." + photo.getOriginalFormat()); byte[] b = new byte[2048]; int length; while ((length = is.read(b)) != -1) { os.write(b, 0, length); } is.close(); os.close(); }
Flickr flickr = new Flickr("xx", "yy", new REST()); Flickr.debugStream = false; requestContext = RequestContext.getRequestContext();
@Override public void setup(ImageCollectionConfig config) throws ImageCollectionSetupException { try { final String apikey = config.read("webpage.flickr.apikey"); final String secret = config.read("webpage.flickr.secret"); flickr = new Flickr(apikey, secret, new REST(Flickr.DEFAULT_HOST)); } catch (final Exception e) { throw new ImageCollectionSetupException("Faile to setup, error creating the flickr client"); } super.setup(config); }
String apikey; String secret; // Create a Flickr instance with your data. No need to authenticate Flickr flickr = new Flickr(apikey, secret, new REST()); // Set the wanted search parameters (I'm not using real variables in the example) SearchParameters searchParameters = new SearchParameters(); searchParameters.setAccuracy(accuracyLevel); searchParameters.setBBox(minimum_longitude, minimum_latitude, maximum_longitude, maximum_latitude); PhotoList<Photo> list = flickr.getPhotosInterface().search(searchParameters, 0, 0); // Do something with the list
flickr = new Flickr(flickrKey, flickrSecret, new REST()); authInterface = flickr.getAuthInterface();
Flickr f = new Flickr(API_KEY, API_SEC, new REST()); return f; } catch (ParserConfigurationException e) {