Instagram Graph API Recent Search result returns blank data

Viewed 65

thank you for reviewing my question.

I've been using Instagram Graph API to make some hashtag recent search.

# Retrieve Keys
key = json.loads(keycontent)
HASHTAG_ID = key['HASHTAG_ID']
USER_ID = key['USER_ID']
ACCESS_TOKEN = key['ACCESS_TOKEN']
CURSOR = key['CURSOR']

topic = 'HASHTAG_ID' # Job
    
# Get Request URL
url = f"https://graph.facebook.com/{HASHTAG_ID}/recent_media?fields=id,permalink,caption,media_url&limit=50&user_id={USER_ID}&access_token={ACCESS_TOKEN}"

if CURSOR != "":
    url = url + '&after=' + CURSOR
    res = requests.get(url)

print(res.json()[‘data’])

It works quite successfully, but problem turns out that it starts to return blank data after calling the function several times. The data I am receiving at the moment are equal to either of the followings:

{"data": []}
{
  "data": [

  ],
  "paging": {
    "cursors": {
      "after": "NEXT_CURSOR"
    },
    "next": "LINK_WITH_NEXT_CURSOR"
  }
}

I've checked several known issues, and the list of what I've checked are stated below.

  1. It is not the permission issue. I've checked all the permissions related, and it is confirmed that the app has all permission it needs.
  2. The app is certainly below the execution limit. Actually, it is mostly even below half of it.
  3. The app is also below the number of hashtags I can search. I've called significantly lower than 30 hashtags within 7 days.

So, I'd like to know if there are potential reasons that I am having blank data for Instagram Graph API call.

Thank you in advance.

0 Answers
Related