Search code examples
instagraminstagram-apiinstagram-graph-api

"instagram graph api" business discovery does not return media url of reels


I'm retrieving influencers data through business discovery and notice that some of the media url for reels are not being returned.

Out of 6 reels media data I've collected, media url only came with oldest one which was posted on April 24th. Second oldest one was posted May 11.

Media url for feed are all collected.

How would I be able to get media url for reels?

Code running are

def user_info(version, igUserId,access_token,username,fields):
    request_url = f"https://graph.facebook.com/{version}/{IgUserID}?fields=business_discovery.username({username}){{{fields}}}&access_token={access_token}"
    response = requests.get(request_url)
    return response.json()
result = user_info(version,IgUserID,accessToken,username,fields)
print(result["business_discovery"]["media"]["data"][0])
print(result["business_discovery"]["media"]["data"][1])

Responce are below. Showing first two in a list

{'id': 'firstID', 'like_count': 6904, 'comments_count': 42, 'timestamp': '2023-06-14T09:09:25+0000', 'username': 'username', 'media_product_type': 'REELS', 'media_type': 'VIDEO'}
{'id': 'secondID', 'like_count': 3691, 'comments_count': 28, 'timestamp': '2023-06-13T11:29:38+0000', 'username': 'username', 'media_product_type': 'FEED', 'media_type': 'CAROUSEL_ALBUM', 'media_url': 'mediaUrl'}, 

Solution

  • As outlined in the documentation:

    "The media_url field is omitted from responses if the media contains copyrighted material or has been flagged for a copyright violation. Examples of copyrighted material can include audio on reels."

    Unfortunately, this is very often the case, as so many reels include copyrighted music. It appears the media_url is simply not available through APIs in these cases.