dounieqi6959 2015-04-21 14:24
浏览 97
已采纳

获取最近3个Instagram图片发布在一个地方

I've been over the Instagram API for a long time, and couldn't find a way to get the last 3 instagram images posted in a specific place.

For example, a visitor search for "Patrick's Pub". The website will redirect him to the pub's page in my website, and there I will be able to display the last 3 instagram images posted in Patrick's Pub.

Is there any way to display these images? I thought about this URL:

https://api.instagram.com/v1/locations/search?lat=*LAT*&lng=*LNG*&access_token=*THETOKEN*

But there are 2 problems with this: 1. I can't find a way to convert LAT and LNG coordinates to a place (like the Patrick's bar) 2. If need an access token for this URL, it means the user need to log in to his instagram account, and it will not be suitable for the website, for just vieweing a place instagram photos.

Any help will be appreciated.

  • 写回答

1条回答 默认 最新

  • dongtuoao7987 2015-04-22 16:29
    关注

    Its a 3-step approach:

    1. Instagram uses Facebook Places to tag a photo to places, you have to use facebook graph API to search for actual places at a location and get the facebook_places_id:

    https://graph.facebook.com/search?q={NAME}&type=place&center={LAT,LNG}&access_token={ACCESS_TOKEN}&expires_in=5184000

    1. You then have to make a Instagram location search API call with the facebook_places_id to get the instagram_location_id:

    https://api.instagram.com/v1/locations/search?facebook_places_id={FACEBOOK_PLACES_ID}&access_token={ACCESS-TOKEN}

    https://instagram.com/developer/endpoints/locations/#get_locations_search

    1. Use the instagram location id to get the recent photos from the place, using the Instagram location media API:

    https://api.instagram.com/v1/locations/{location-id}/media/recent?access_token={ACCESS-TOKEN}

    https://instagram.com/developer/endpoints/locations/#get_locations_media_recent


    Here is an implementation of this search: http://www.gramfeed.com/instagram/places
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?