D
D
dmitriev_romka2020-04-16 12:48:07
API
dmitriev_romka, 2020-04-16 12:48:07

Request data from instagram via ID?

Good day!

I get data with a request https://www.instagram.com/ptencoff/?__a=1
The problem is that some users change their nicknames, so the request gives an error.
I have an idea, to receive requests via user ID.

Tell me how to make a request like https://www.instagram.com/ptencoff/?__a=1 but not through a nickname, but through an ID
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Komlev, 2020-04-16
@dmitriev_romka

  1. You need to save the internal user ID from Instagram to the database.
  2. In case of an error, you can check the ID through some function, through the official API, through the private mobile or through the web API.
  3. For example, here the user_id for the apple account is 5821462185 , and query_hash is a static parameter, but it is different every time you visit the site. Although you can use the same query_hash as long as it works.
  4. Save the new username to the database (if needed).
  5. Get the number of followers via https://www.instagram.com/new-username/?__a=1
  6. You need to send requests to https://www.instagram.com/graphql/query/ with at least a delay of 1 second so that you don't get banned. A longer delay may be required.
  7. The solution described below works without authorization.
  8. And it is desirable to collect data using a proxy. For this task, a mobile phone for $8/month from LTESpace , whose IP changes every 2 minutes, is perfect.

Request URL
https://www.instagram.com/graphql/query/?query_hash=ad99dd9d3646cc3c0dda65debcd266a7&variables={"user_id":5821462185,"include_reel":true}

Response
5e983c0c22149343928669.png

K
KingAnton, 2020-04-16
@KingAnton

<user_id>and <num_of_posts>change to yours

https://www.instagram.com/graphql/query/?query_id=17888483320059182&variables=%7B%22id%22%3A%22<user_id>%22%2C%22first%22%3A<num_of_posts>%7D

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question