简体   繁体   中英

Using Https Protocol for downloading data from Flickr

Since June 2014, all API keys just work via HTTPS only.Flickr deprecate non-SSL access to the API. There is another Post, but It's for 6 years ago which is before this event. I know how to download data from Flickr, and I know it should work, but the problem is the library doesn't support Https.

I am trying to count the number of Images that have been shared by a user. I used getPeopleInterface().getPublicPhotos(userId,100,1) method.

but the problem is, it returns back Error 403 for URL! I checked the Url in browser, and the Error is "SSL is required." So I changed http to https in the URL and it worked. I do not know how I can change it in my code.

public class GetUsersPhotos {
       public static void main(String[] args) throws Exception{

            String key = "";
            String secret = "";
            String userId = "78069284@N00";


            Transport t = new REST();
            Flickr f = new Flickr(key, secret, t);

            PhotoList list = f.getPeopleInterface().getPublicPhotos(userId,100,1);
            System.out.println(list);
        }


}

I solved my problem. The Flickrapi 1.2,doesn't support Https Protocol. What I did I downloaded Flickr4Java.jar which I checked and support Https, and then add the latest log4j jar file. then, it works.

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