最佳
目标: 接收地理数据(坐标),时间戳...... “从在维也纳拍摄的照片。”
我的问题: 我怎么能用Java做到这一点? (使用flickrapi-1.2.jar)
我发现了什么? : 给我500张最近的照片 - 网址...:s
public static void main(String[] args) throws FlickrException, IOException,
SAXException {
String apiKey = "123456789abcdefghijklmnopqrstvwuxz";
Flickr f = new Flickr(apiKey);
PhotosInterface photosInterface = f.getPhotosInterface();
Collection photosCollection = null;
photosCollection = photosInterface.getRecent(500, 0);
int i = 0;
Photo photo = null;
Iterator photoIterator = photosCollection.iterator();
while (photoIterator.hasNext()) {
i++;
photo = (Photo) photoIterator.next();
System.out.println(i + " - Description: " + photo.getSmallUrl());
}
}
选项:好的例子或体面的手册是welkom,因为我不确切知道这个API是如何工作的......
亲切的问候
答案 0 :(得分:3)
您需要调用flickr.photos.search API方法。
使用Flickr4Java,它看起来像这样:
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