Sven
Sven

Reputation: 1107

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?

Upvotes: 4

Views: 2531

Answers (1)

Tok1
Tok1

Reputation: 111

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

Upvotes: 5

Related Questions