First Last
First Last

Reputation: 257

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. In this example I want an instance of this 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?

Upvotes: 1

Views: 516

Answers (1)

Forge
Forge

Reputation: 6844

This behaviour can be explained by checking if your application is in sandbox mode. Every new application on Instagram starts at sandbox mode. In this mode you are only exposed to data from other sandbox users (restricted to 10 users) on your app.

From the API:

As another example, let's consider an endpoint that returns a list of media: /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.

Upvotes: 1

Related Questions