2019-10-05 16:14:59 +00:00
|
|
|
import webbrowser as wb
|
2018-10-02 20:05:01 +00:00
|
|
|
import requests
|
2018-11-17 12:23:58 +00:00
|
|
|
import re
|
|
|
|
import json
|
2018-10-02 20:05:01 +00:00
|
|
|
|
|
|
|
|
2018-11-17 12:23:58 +00:00
|
|
|
username=input("Enter the username : ")
|
2018-10-02 20:05:01 +00:00
|
|
|
|
|
|
|
try:
|
2018-11-17 12:23:58 +00:00
|
|
|
content = requests.get("https://www.instagram.com/"+username).content
|
|
|
|
find=re.findall(r"logging_page_id.*show_suggested_profiles",str(content))
|
|
|
|
user_id=((find[0][16:]).split(","))[0][14:-1] # We get the user id of the username
|
|
|
|
jsonreq=requests.get("https://i.instagram.com/api/v1/users/"+user_id+"/info/").content # using a link we get the whole info of the person
|
|
|
|
jsonloaded=json.loads(jsonreq)
|
|
|
|
imgurl=jsonloaded["user"]["hd_profile_pic_url_info"]["url"]
|
|
|
|
wb.open_new_tab(imgurl)
|
|
|
|
except:
|
|
|
|
print("No such username exists")
|