Answer the question
In order to leave comments, you need to log in
Parser returns html instead of json?
Wrote an instagram parser to get the id and username of a user from a link.
Here is the code:
href = 'https://instagram.com/instagram/'
response = requests.get(href + '?__a=1')
user = json.loads(response.text) #получаем json, в котором указан id и username
user_id = user['graphql']['user']['id'] #получаем id
username = user['graphql']['user']['username'] #получаем username
print(user_id, username) #выводим id и username
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question