Thumnails for images in Instagram Graph API

丶灬走出姿态 提交于 2020-12-30 05:32:46

问题


I'd like to ask if there is any way to get thumbnail image for media returned from Instagram Graph API? I can get an image URL by using following endpoint: /{InstagramUserId}/media?fields=media_url

However it only returns one size. Old Instagram API returned various sizes like low_resolution, thumbnail, standard_size. Is it possible to get similar result by using Instagram Grahp API?


回答1:


After searching for some time to a solution i finally found one.

So, include in the fields query string the permalink field and it should give as following (Sorry, for using Kim Kardashian as an example):

https://www.instagram.com/p/CAYDz52gSLh

then append this at the end media?size=t or simply media like this:

https://www.instagram.com/p/CAYDz52gSLh/media?size=t

  • media?size=t will give a 150x150 px image
  • media?size=m will give a 320x320 px image
  • media?size=l will give a 1080x1080 px image



回答2:


I can not find a way to get the thumbnails in one step. But in the next step after receiving the data, the thumbnail of each image and video can be found in this way using oEmbed:

https://graph.facebook.com/v9.0/instagram_oembed?url={permalink}&maxwidth=320&fields=thumbnail_url,author_name,provider_name,provider_url&access_token={accessToken}

permalink: The url received from the previous stage (business_discovery)

Example:

https://graph.facebook.com/v9.0/instagram_oembed?url=https://www.instagram.com/p/CBOuPY1AcMQ/&maxwidth=320&fields=thumbnail_url,author_name,provider_name,provider_url&access_token={accessToken}

More Details



来源:https://stackoverflow.com/questions/51822488/thumnails-for-images-in-instagram-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!