Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Instagram API to get other users bio?

I'm a bit confused about the capabilities of the instagram basic display api...

I want to create a web app where the users put a link in their instagram bio in order to validate their account. I want my web app to check this through the instagram api.

Is this something that is possible and legal/allowed?

like image 457
Sven Avatar asked Sep 12 '25 00:09

Sven


1 Answers

You can use https://www.instagram.com/<name>/?__a=1 to get some info about a user

import requests

user = "linustech"

headers = {
    'User-Agent': ''
}


r = requests.get(f"https://www.instagram.com/{user}/?__a=1", headers=headers)
userinfo = r.json()["graphql"]

bio = userinfo["user"]["biography"]


print(bio)
# Official Instagram account for Linus Tech Tips. Run by the entire LMG team. Get 20% off @manscaped at ↙

Instagrams robots.txt states that search engine crawlers can't use any URL with __a=1. More info here

like image 118
Tok1 Avatar answered Sep 13 '25 13:09

Tok1