Content
At work, I came across an interesting task of automating Instagram , namely, it was just necessary to hold a drawing. There are enough services for organizing this venture, there are even free ones. But there were additional (read premium) conditions, besides, I really wanted to see for myself what was inside this popular instagram and maybe gain experience in building an API.
First of all, I went to see what the Internet was saying. Reading the official docks on the instagram API made it clear that the owners do not want to give access to unlimited automation, you can automate work with your account in the basic version, but this did not fit my task, and the "business" version of the API required company verification, which is natural it does not suit me. (Maybe something has already changed ...)
Then I went to see what the Internet was saying about working with the API on the Instagram website. Everything was rosy and did not bode well for problems. There were even php projects on github that provided APIs for automation up to posting. Articles on Habré talked about the ease of automation. Many of the springs were of normal freshness (a couple of months, or even weeks). However …
Authorization
(fiddler + waterfox) instagram . . .
, .
- POST https://www.instagram.com/accounts/login/ajax/ . enc_password - , : ( , ) :
(PWDINSTAGRAMBROWSER)
(10)
(unixtime 1591030811)
unixtime , .
, , . github nodejs. , .
. , instagram . ( ) , . .
, , js. js ( ) … ( ), , .
instagram php, js. ( xhr , fiddler) php . - .
… . 7 - , - ( , ip), ).
nodejs puppeteer . :)
, , ( ) . , ( ) . - . , , , :)
, ( ):
php node.js , node.js , , , .
. . html :
:)
, , . . Instagram API graphql (- rust-full ). .
:
query_hash - :
- d5d763b1e2acf209d62d22d184488e57
- bc3296d1ce80a24b1b6e40b1e72903f5
- c76146de99bb02f6415203be841dd25a
- ff260833edf142911047af6024eb634a
variables - json (urlencode ), , , , :
first - ( 50 50)
after - ffirst. fafter , , ( null)
:
API 20 .
I am disappointed with the quality of the instagram API in the web version of the site, I did not think it would be so mediocre, it seems that everything is twisted to the maximum on generating data for authorization , but then everything is lowered and a big security hole is formed - I stole cookies with headers and gained access .
Instagram made me sweat and experience various emotions from using the API, but the goal was achieved in full. Author: Vitaly Buturlin