Skip to content

Instantly share code, notes, and snippets.

@witchfindertr
Created September 11, 2022 17:04
Show Gist options
  • Select an option

  • Save witchfindertr/d662ee148e82feb31e708f5aa61daedd to your computer and use it in GitHub Desktop.

Select an option

Save witchfindertr/d662ee148e82feb31e708f5aa61daedd to your computer and use it in GitHub Desktop.
def get_user_id(username):
headers = {
'authority': 'i.instagram.com',
'accept': '*/*',
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
'origin': 'https://www.instagram.com',
'referer': 'https://www.instagram.com/',
'sec-ch-ua': '"Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
'x-csrftoken': '2SAvFYoHgS8GwleiP7j5vTLPqRJX4IFL',
'x-ig-app-id': '936619743392459',
}
params = {
'username': username,
}
r = requests.get('https://i.instagram.com/api/v1/users/web_profile_info/', params=params, headers=headers)
id = r.text.split('"id":"')[2].split('"')[0]
return
https://github.com/Hazza3100/Instagram-Aio/blob/main/main.py
@witchfindertr
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment