2017-02-25 64 views
1

我使用Instagram的Get Recent Media終端從標籤獲取圖像和視頻。根據相關文檔,這裏是一個video媒體json樣子(跳過簡潔等領域):Instagram API:json響應中缺少的元素

{ 
    "type": "video", 
    "videos": { 
     "low_resolution": { 
      "url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_102.mp4", 
      "width": 480, 
      "height": 480 
     }, 
     "standard_resolution": { 
      "url": "http://distilleryvesper9-13.ak.instagram.com/090d06dad9cd11e2aa0912313817975d_101.mp4", 
      "width": 640, 
      "height": 640 
     } 
    } 
} 

因此,對於每一個媒體jsontype=video,應該有一個videos元素。然後我試圖與quakeroats作爲標籤的請求,URL如下:

https://api.instagram.com/v1/tags/quakeroats/media/recent?access_token=<access_token> 

它返回的介質的列表下面的媒體之一:

{ 
    "id": "1457772143914843055_4607772970", 
    "type": "video", 
    "created_time": "1488000003", 
    "images": { 
     "thumbnail": { 
      "height": 150, 
      "width": 150, 
      "url": "https://scontent.cdninstagram.com/t51.2885-15/s150x150/e35/16788643_240567646348968_4950335324904488960_n.jpg" 
     }, 
     "low_resolution": { 
      "height": 320, 
      "width": 320, 
      "url": "https://scontent.cdninstagram.com/t51.2885-15/s320x320/e35/16788643_240567646348968_4950335324904488960_n.jpg" 
     }, 
     "standard_resolution": { 
      "height": 480, 
      "width": 480, 
      "url": "https://scontent.cdninstagram.com/t51.2885-15/e35/16788643_240567646348968_4950335324904488960_n.jpg" 
     } 
    }, 
    "user": { 
     "username": "aslapesetme.43kilo", 
     "full_name": "\u0130nan\u0131rsan Olur", 
     "id": "4607772970", 
     "profile_picture": "https://scontent.cdninstagram.com/t51.2885-19/s150x150/16230854_382859295410786_1559541722264895488_a.jpg" 
    }, 
    "user_has_liked": false, 
    "link": "https://www.instagram.com/p/BQ7DAqRgPuv/", 
    "attribution": null, 
    "location": null, 
    "likes": { 
     "count": 22 
    }, 
    "comments": { 
     "count": 0 
    }, 
    "caption": { 
     "text": "\ud83d\udca08:00\ud83d\udca0 kahvalt\u0131:\n-50 gr. Yulaf\n-1 bardak s\u00fct\n-1 porsiyon meyve ve 1 \u00e7ay ka\u015f\u0131\u011f\u0131 kakao nibs\nNefiiss \ud83d\ude0b \u00e7ok \u015f\u00fck\u00fcr bizi doyuran rabbimize \ud83d\ude4f\ud83c\udffb Ayr\u0131ca frambuaz ve elman\u0131n sadece renk uyumu de\u011fil tat uyumu da m\u00fcthi\u015f deneyin \ud83d\udc7b\n#healtyfood#healthybreakfast#quakeroats#quakeroatmeal#quakerporridge#milk#apple#raspberries#framboise#ahududu#yulaflapasi#yulafezmesi#porridgelover#porridge#cacaonibs#diyet#diyetkardesligi#diyethesaplaritakiplesiyor#inan\u0131rsanolur#sadeceinan#eceilezayifliyorum#doganinguzelligi#dogalbeslen#kendinisev#benimkahvaltim#nofilter#greentea#whitetea#ginger#hediyenhayatinolsun", 
     "from": { 
      "username": "aslapesetme.43kilo", 
      "full_name": "\u0130nan\u0131rsan Olur", 
      "id": "4607772970", 
      "profile_picture": "https://scontent.cdninstagram.com/t51.2885-19/s150x150/16230854_382859295410786_1559541722264895488_a.jpg" 
     }, 
     "created_time": "1488000003", 
     "id": "17849784529188561" 
    }, 
    "filter": "Normal" 
} 

它似乎有type設置爲video,但是,沒有videos元素。此外,媒體鏈接(https://www.instagram.com/p/BQ7DAqRgPuv/)似乎指向圖像而不是視頻。

看起來像是API錯誤或API響應格式的最近更改(僅在最近幾天內我看到導入腳本中的錯誤)或兩者。

有沒有人注意到了這一點?另外,這是我應該提交給Instagram的嗎?

回答

0

我剛剛碰到這個,當時我正在嘗試更新一些代碼以使用他們的新的多圖像(或視頻)功能。 Instagram現在允許您將多個圖像作爲單個帖子上傳,然後您可以在用戶界面中在它們之間進行滑動。看起來這在API中並沒有真正考慮到,所以多項目帖子返回爲type=video(如果它們應該是type=image,如果它們都是圖像,或者可能是type=multi或其他新的)。

我的使用案例更煩人的是,他們也沒有包含單個帖子中包含的每個不同媒體項目所需的數據,所以我無法完全重新創建多項目帖子,因爲我不知道除了「甲板」中的第一張圖像之外,什麼都不知道。

1

目前在API中如果type="video"沒有「視頻」鍵意味着它是多圖像文章。

(貌似是一個bug和Instagram可能最終會改變它)