简体   繁体   English

无法从 Instagram API 获取所有标签

[英]Can't get all tags from Instagram API

I'm using the python-instagram client and I want to grab all the photos of a specific tag.我正在使用python-instagram客户端,我想获取特定标签的所有照片。 In this example I want an instance of this URL: https://www.instagram.com/explore/tags/flowers/在这个例子中,我想要这个 URL 的一个实例: https : //www.instagram.com/explore/tags/flowers/

Currently it only takes the photos with that tag, that I personally uploaded from my account.目前它只拍摄带有该标签的照片,这些照片是我个人从我的帐户上传的。

This is my code:这是我的代码:

# Instagram
ACCESS_TOKEN = 'X'
CLIENT_SECRET = 'X'
CLIENT_ID = 'X'
INSTAGRAM_API = InstagramAPI(access_token=ACCESS_TOKEN, client_id=CLIENT_ID, client_secret=CLIENT_SECRET, redirect_uri='http://localhost:8000/')

recent_instagram_media, next_ = settings.INSTAGRAM_API.tag_recent_media(count=5, max_tag_id=5, tag_name='flowers')
    photos = []
    for media in recent_instagram_media:
        photos.append(media.images['standard_resolution'].url)

What do I do wrong here?我在这里做错了什么?

This behaviour can be explained by checking if your application is in sandbox mode .这种行为可以通过检查您的应用程序是否处于sandbox mode来解释。 Every new application on Instagram starts at sandbox mode . Instagram 上的每个新应用程序都以sandbox mode启动。 In this mode you are only exposed to data from other sandbox users (restricted to 10 users) on your app.在此模式下,您只会在您的应用程序上接触来自其他沙箱用户(限制为 10 个用户)的数据。

From the API:从API:

As another example, let's consider an endpoint that returns a list of media: /tags/{tag-name}/media/recent.作为另一个例子,让我们考虑一个返回媒体列表的端点:/tags/{tag-name}/media/recent。 The response returned by this endpoint will contain only media with the given tag, as expected.正如预期的那样,此端点返回的响应将仅包含具有给定标签的媒体。 But instead of returning media from any public Instagram user, it will return only media that belongs to your sandbox users, restricted to the last 20 for each user.但它不会返回来自任何公共 Instagram 用户的媒体,它只会返回属于您的沙箱用户的媒体,限制为每个用户的最后 20 个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM