【问题标题】:How can i get the facebook video details using facebook copy Url in android如何在 android 中使用 facebook 复制 Url 获取 facebook 视频详细信息
【发布时间】:2017-10-30 07:02:46
【问题描述】:

我想使用 Facebook 复制 URL 检索 facebook 视频 mp4 URL 和拇指图像。我在获取视频详细信息时收到 200 权限错误。我的代码如下。请任何人帮助我解决这个问题。

https://www.facebook.com/shreyaghoshal/posts/10155774118036484

 request= GraphRequest.newMeRequest( AccessToken.getCurrentAccessToken(),
                new GraphRequest.GraphJSONObjectCallback() {
                    @Override
                    public void onCompleted(
                            JSONObject object,  GraphResponse response) {
                        try {
                            if(object!=null) {
                                create_facebookID = object.getString("id").toString();
                                Log.e("facebook" ,"id"+create_facebookID);

                                new GraphRequest(
                                        AccessToken.getCurrentAccessToken(),
                                      create_facebookID+"_10155774118036484",
                                        null,
                                        HttpMethod.GET,
                                        new GraphRequest.Callback() {
                                            public void onCompleted(GraphResponse response) {

                                                Log.e("response", "res...." + response.toString());
                                            }
                                        }
                                ).executeAsync();
                            }
                        }catch (Exception e){
                            e.printStackTrace();

                        }
                    }
                });

        Bundle parameters = new Bundle();
        parameters.putString("fields", "id,name,email,gender, birthday");
        request.setParameters(parameters);
        request.executeAsync();

这是我得到的回应。我想获取视频网址。 10-31 10:04:45.203 27233-27233/com.tweak.tweak 视频 E/response: res....{Response: responseCode: 200, graphObject: {"created_time":"2017-10-09T09:12:56+0000","message":"‪I think I forgot how to breathe! Heart skipped beats. #PadmavatiTrailer is pure goosebumps. #SanjayLeelaBhansali has created the unthinkable.‬\nThe poetic magic that he alone can bring to the screens.Deepika Padukone Shahid Kapoor Ranveer Singh bring their best in this film! Music coming soon. Stay tuned.","the story":"Shreya Ghoshal shared Padmavati's video.","id":"11541726483_10155774118036484"}, error: null}

【问题讨论】:

  • 您需要提取视频id(字符串函数,正则表达式),然后使用该id通过API查询对象的详细信息。

标签: android facebook video


【解决方案1】:

经过这么多时间的研究。我得到了解决方案。现在我可以获取视频的视频详细信息。我为捆绑包添加了密钥。现在我可以获取视频详细信息。

      if (Youtube_videos.fb_post_url) {
                                    request_fb_post = new GraphRequest(
                                            AccessToken.getCurrentAccessToken(),                                    
                                                create_facebookID + "_10155774118036484",
                                            null,
                                            HttpMethod.GET,
                                            new GraphRequest.Callback() {
                                                public void onCompleted(GraphResponse response) {

                                                    Log.e("response", "res...." + response.toString());
                                                }
                                            }
                                    );
                                    Bundle parameters = new Bundle();
                                    parameters.putString("fields", "id,caption ,object_id ,permalink_url ,picture,source,status_type,properties,type ");
                                    request_fb_post.setParameters(parameters);
                                    request_fb_post.executeAsync();

【讨论】:

    猜你喜欢
    • 2015-07-19
    • 1970-01-01
    • 2017-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-20
    相关资源
    最近更新 更多