Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API: Can i check if user is verified?

I would like to know if there is any way to check if the user verification badge with the Instagram API?

I have saw that https://api.instagram.com/v1/users/{user-id} doesn't returns if the user is verified, but if you view the source code of a users page, you can see that it has a boolean that called isVerified key and it's value inside a json struct of the user.

Thanks!

like image 261
Amnonk Avatar asked Feb 02 '15 18:02

Amnonk


People also ask

How do you know if someone is verified on Instagram?

A verified badge is a check that appears next to an Instagram account's name in search and on the profile. It means Instagram has confirmed that an account is the authentic presence of the public figure, celebrity or brand it represents.

Can you check Instagram verification status?

Once we review your request, you'll receive a notification in Activity up to 30 days after applying letting you know if your account has been verified or not. You can tap in the top right to see notifications in Activity.

What info can you get from Instagram API?

The API can be used to get and publish their media, manage and reply to comments on their media, identify media where they have been @mentioned by other Instagram users, find hashtagged media, and get basic metadata and metrics about other Instagram Businesses and Creators.

Can Instagram take your blue check?

Even if you do get verified on Instagram, know that you can lose that blue tick. This is usually the case if you fail to follow Instagram's Terms of Use and Community Guidelines, or if Instagram finds that you provided misleading or false information ini your verification application.


1 Answers

Ok, this is not a great answer but here is how I accomplished this same task. Once I have a username from the API I do the following regex on the source of their profile page:

$response = file_get_contents('https://instagram.com/'.$username);
if (preg_match('/"user":\{"username":"'.$username.'",.*?"isVerified":true\},"__path":".*?'.$username.'.*?"/s', $response) || preg_match('/<meta content=".*?official.*?account.*?" name="description" \/>/is', $response)) {
    print "VERIFIED USER!";
}

As I said before this is super hacky but the API currently doesn't provide an isVerified value. Until they do I am using this regular expression. It looks for "isVerified":true part of the JSON struct you referenced. (example: https://instagram.com/taylorswift)

We also added an additional check where if the meta content tag has "official account" in it then we assume it's official. (example: https://instagram.com/3doorsdown) We added this check because Instagram started doing verified accounts in 2014 and there are quite a few celebrities that haven't gotten a verified badge yet. It should pick up some of the pieces but could very well bring in false positives too.

NOTE: This solution will break if Instagram ever changes the JSON struct or meta tags on their pages so use at your own risk. We only needed a script to check a small amount of usernames for verified badges and I came up with this real quick. The best solution will be whenever they update their API.

like image 132
Michael Taggart Avatar answered Oct 23 '22 01:10

Michael Taggart