【问题标题】:getting high resolution photos that were posted on a page wall/feed获取发布在页面墙/提要上的高分辨率照片
【发布时间】:2012-03-22 11:43:21
【问题描述】:

我的页面墙带有打开的图表。 当有人发布照片时,我会在 JSON 上得到它

{
     "id": "27888702146_10150369820322147",
     "from": {
        "name": "brocoli",
        "category": "Record label",
        "id": "27888702146"
     },
     "message": "Vincent Epplay / David Fenech / Jac Berrocal \u00e0 Beaubourg ce soir, 19h, gratos.",
     "picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc7/305819_10150369820292147_27888702146_8255527_583491475_s.jpg",
     "link": "https://www.facebook.com/photo.php?fbid=10150369820292147&set=a.386279807146.165840.27888702146&type=1",
     "icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
     "type": "photo",
     "object_id": "10150369820292147",
     "created_time": "2011-10-16T08:22:21+0000",
     "updated_time": "2011-10-16T08:22:21+0000",
     "likes": {
        "data": [
           {
              "name": "brocoli",
              "category": "Record label",
              "id": "27888702146"
           },
           {
              "name": "Agathe Morier",
              "id": "601668526"
           }
        ],
        "count": 2
     },
     "comments": {
        "count": 0
     },
     "is_published": true
  }

问题是图片链接是图片的低分辨率副本。

如何获取全图的网址?

谢谢!!

最好的

杰弗里

【问题讨论】:

  • 你有解决方案吗,下面的答案不起作用。

标签: facebook-graph-api feed image


【解决方案1】:

您可以通过使用object_id(不是照片post_id,即您提供的结果中的id)查询Graph API 来获得不同版本的photo

一旦您通过对象 id 请求 photo,您将获得带有 URL 和尺寸的 images 数组:

http://graph.facebook.com/10150369820292147?fields=images

【讨论】:

  • 非常感谢...完美
  • 非常感谢。很好的答案:)
  • @Juicy Scripter 如果我的提要中没有 object_id 怎么办。
  • @Juicy Scripter,感谢您的出色回答,但对于提要类型“视频”,它因以下响应而失败。 {"error":{"message":"不支持的获取请求。请阅读 https:\/\/developers.facebook.com\/docs\/graph-api 上的 Graph API 文档","type":"GraphMethodException" ,"代码":100}}
  • @Juicy Scripter : 不工作'不支持的获取请求'graph.facebook.com/397556853726341?fields=images
【解决方案2】:

你需要做的就是:

http://graph.facebook.com/me?fields=picture.height(961) 
// replace 961 with your required height which u want

【讨论】:

  • 这应该是公认的答案。目前唯一有效的方法。
【解决方案3】:

您现在可以使用

从主帖子列表中执行此操作
/v2.3/105753476132681/posts?limit=5&fields=likes.summary(true),comments.summary(true), attachments

如果附件不起作用,请尝试 full_picture - 但这也只是为我提供了 100x100 的图像。

附件至少返回带有 640x480 版本图像的数据哈希(不确定我的原始照片尺寸是多少)

【讨论】:

    【解决方案4】:

    虽然通过object_id 请求照片会返回不同尺寸的图像数组,但在某些情况下,这种方法需要额外调用 Facebook API。

    更简单的方法是将full_picture 添加到您的参数列表中,这将提取与帖子相关联的最高分辨率图像。

    /v2.2/6275848869/posts?fields=full_picture
    

    例如,如果您想提取过去 X 天内 Facebook 页面中的所有帖子,使用 object_id 方法您需要调用 API 3 次:

    1. 获取页面信息。
    2. 提取帖子列表并获取每个帖子的object_id
    3. 对于每个object_id,检索更高分辨率图像的列表。

    【讨论】:

      【解决方案5】:

      使用此代码。它为我工作并获得清晰的图像

      String PICTURE_URL;
      
      String getPicture = hashMap.get("picture");
              if (getPicture.contains("_t.")) {
                  PICTURE_URL = getPicture.replaceAll("_t.", "_n.");
              } else if (getPicture.contains("_a.")) {
                  PICTURE_URL = getPicture.replaceAll("_a.", "_n.");
              } else if (getPicture.contains("_s.")) {
                  PICTURE_URL = getPicture.replaceAll("_s.", "_n.");
              } else if (getPicture.contains("_q.")) {              
                  PICTURE_URL = getPicture.replaceAll("_q.", "_n.");
              }
              url=new URL(PICTURE_URL);
              Bitmap bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
              ((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap);
      

      【讨论】:

      • 对我来说它有时有效,有时无效....为什么 facebook 让获取图片变得如此愚蠢
      猜你喜欢
      • 2015-05-14
      • 1970-01-01
      • 2013-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多