Skip to content

Instantly share code, notes, and snippets.

@Karn
Created February 28, 2019 20:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Karn/65d074f5c94bd39782c8fe5b2751a7a6 to your computer and use it in GitHub Desktop.
Save Karn/65d074f5c94bd39782c8fe5b2751a7a6 to your computer and use it in GitHub Desktop.
def fetch_profile(self, primary_key):
response = requests.get('https://i.instagram.com/api/v1/users/{}/info/'.format(primary_key),
headers={
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36',
'dnt': '1',
'pragma': 'no-cache',
'x-ig-app-id': '936619743392459'
})
if (response.status_code != 200):
return None
res = response.json()
if 'user' in res:
return res['user']
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment