是否可以将图像从我的网络应用程序上传到 Instagram?

问题描述 投票:0回答:2

是否可以将图像从我的网络应用程序上传到 Instagram ???

如果是的话怎么办??

我已经尝试过以下代码。但我不知道如何上传图片??

    String clientId = "XXXXXx";
    String clientSecret = "XXXXXXX";

    String callbackUrl = "http://xxxx.com/InstaGram/Auth";

    InstagramService service = new InstagramAuthService().apiKey(clientId).apiSecret(clientSecret).callback(callbackUrl).scope("comments").build();

    String authorizationUrl = service.getAuthorizationUrl(EMPTY_TOKEN);

    System.out.println("** Instagram Authorization ** \n\n");

    System.out.println("Copy & Paste the below Authorization URL in your browser...");
    System.out.println("Authorization URL : " + authorizationUrl);

    Scanner sc = new Scanner(System.in);

    String verifierCode;

    System.out.print("Your Verifier Code : ");
    verifierCode = sc.next();

    System.out.println();

    Verifier verifier = new Verifier(verifierCode);
    Token token = service.getAccessToken(EMPTY_TOKEN, verifier);


    System.out.println("Token : " + token.getToken());

    String accessToken = "7073519.44e6baf.d44336e2e99741f6a5bed94b26f1699c";

    Token secretToken = new Token(accessToken, null);

    Instagram instagram = new Instagram(secretToken);


    UserInfo userInfo = instagram.getCurrentUserInfo();

    MediaFeed mediaFeed = instagram.getRecentMediaFeed(userInfo.getData().getId());
    // MediaFeed mediaFeed =  instagram.getUserFeeds();

    List<MediaFeedData> mediaList = mediaFeed.getData();

    for (MediaFeedData data : mediaList) {
        System.out.println("data : " + data.getId());

        //instagram.setMediaComments(data.getId(), "Comment was created at " + new Date().toString());
    }

    System.out.println("***** User Info ******");
    System.out.println("Username : " + userInfo.getData());
}

如果有什么办法请告诉我...

请帮助我..

谢谢...

java instagram
2个回答
1
投票

没有办法实现它。

http://instagram.com/developer/endpoints/media/

您只能通过其余媒体端点获取媒体。


0
投票

是的,其实有办法,你可以使用Instagram Graph API。

您可以阅读此链接中的所有文档:https://developers.facebook.com/docs/instagram-api/

© www.soinside.com 2019 - 2024. All rights reserved.