2016-07-26 111 views
2

我会按照Instagram的API嵌入登录用户的一些媒体:如何从Instagram API找到媒体的SHORTCODE或SHORTLINK?

https://api.instagram.com/oembed?url=http://instagr.am/p/fA9uwTtkSN/ 

但需要shortlink或至少简码生成的链接。不幸的是使用下面的API既不会返回短链接也不会缩短代码。

https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN 

有没有想法解决这个问题?

回答

1

在JSON API响应是有“链接”,那就是shortlink网址:

{ 
     "data": [{ 
      "comments": { 
       "count": 0 
      }, 
      "caption": { 
       "created_time": "1296710352", 
       "text": "Inside le truC#foodtruck", 
       "from": { 
        "username": "kevin", 
        "full_name": "Kevin Systrom", 
        "type": "user", 
        "id": "3" 
       }, 
       "id": "26621408" 
      }, 
      "likes": { 
       "count": 15 
      }, 
      "link": "http://instagr.am/p/BWrVZ/", 
      "user": { 
       "username": "kevin", 
       "profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_3_75sq_1295574122.jpg", 
       "id": "3" 
      }, 
.... 
+0

谢谢您的回答,但对于使用嵌入API,必须考虑该帐户不应该**私人的**。 – Mossen

+0

是的,如果您使用API​​获取短链接,那么您不必担心,导致instagram不再通过API提供私人个人资料数据 – krisrak

相关问题