问题
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 imagemedia?size=m
will give a 320x320 px imagemedia?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