Facebook GraphAPI图片/ full_picture永久链接

时间:2017-01-06 04:36:15

标签: facebook facebook-graph-api facebook-fql

如何在帖子中获取图片的永久链接?例如,我可以获得有关一个​​帖子的所有信息:

912163612218997/?fields=picture,full_picture,attachments

   {
     "picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/15390764_10154771322382505_5131571043698309499_n.jpg?oh=de4126b3944deb9fb7fca6b534e5e987&oe=58E45F29",
     "full_picture": "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/15326300_10154771322382505_5131571043698309499_o.jpg?oh=414291d1c1fbc88988afb887177a03c5&oe=59156F5D",
     "id": "189675924467773_912163612218997",
     "attachments": {
       "data": [
         {
           "description": ...,
           "media": {
             "image": {
               "height": 372,
               "src": "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/15326300_10154771322382505_5131571043698309499_o.jpg?oh=414291d1c1fbc88988afb887177a03c5&oe=59156F5D",
               "width": 720
             }
           },
           "target": {
             "id": "10154771322382505",
             "url": "https://www.facebook.com/photo.php?fbid=10154771322382505&set=gm.912163612218997&type=3"
           },
           "type": "photo",
           "url": "https://www.facebook.com/photo.php?fbid=10154771322382505&set=gm.912163612218997&type=3"
         }
       ]
     }
   }

然而,这些图片链接是暂时的。几个小时后就无法使用。

有没有办法从Facebook GraphAPI获取永久图片网址?

1 个答案:

答案 0 :(得分:0)

我想弄清楚使用重定向的解决方法:

  1. 使用对象ID和获取CDN网址的Fire Graph API
  2. 重定向到CDN网址
  3. 基本上,只要我们知道对象id,我们就可以获得URL。不幸的是,它有点慢。