Instagram api - get all photos by hashtag

喜夏-厌秋 提交于 2019-12-04 19:29:24

问题


I am new to this Instagram API, and I read their doc about endpoints, this is the endpoint that I am using:

/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN

It is fetching the images, but, only on my accounts photos. I want is, I will give an tag-name, and it wll display all, not just the photos on my account, but all the photos in Instagram too.


回答1:


I know has been a long time, but just for the record.

Since you need the public_scope permission for this (the permission that gives you access to all public data on instagram, and not only your account) you need your app to be reviewed and approved by Instagram. However, if you're using the API for a one-site personal project, Instagram will not approve it.

Here's from Instagram's docs:

1: Which use case best describes your Instagram integration?

R: I want to display hashtag content and public content on my website.

A: This use case is not supported. We do not approve the public_content permission for one-off projects such as displaying hashtag based content on your website. As alternative solution, you can show your own Instagram content, or find a company that offers this type of service (content discover, moderation, and display).

You can find more information in the Permission Review documentation.




回答2:


Your client is in Sandbox Mode and can only search for tags of photos posted by invited users. You have to login into https://www.instagram.com/developer, edit your client and click on the "GO LIVE" button.

If the "GO LIVE" button is disabled, you have get your app reviewed by Instagram first: Click on the Permissions tab and submit for review. (Company Name, Contact Email and Privacy Policy URL are required to start a submission.) Once approved, u will be able to click Go Live.




回答3:


By hashtag you mean tags.
It works for me. Despite I'm using python client, it should work well when you're developing your own client. Look:

from instagram.client import InstagramAPI

api =InstagramAPI(client_secret=settings.CLIENT_SECRET,
                   access_token=settings.ACCESS_TOKEN)

result = api.tag_recent_media(tag_name='castle')
media = result[0]

for m in media:
    print (m.images)
    print (m.user)
    print (m.tags)



回答4:


You can try it and it is working for me.

/v1/tags/{tag-name}/media/recent?client_id={YOUR_CLIENT_ID}

My client id is created before "permission review", it is working now and I am trying to submit permission review to Instagram now, hope it will pass.



来源:https://stackoverflow.com/questions/34734962/instagram-api-get-all-photos-by-hashtag

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