dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.93k stars 1.14k forks source link

How to get sessionid after login? #1700

Open dumitruPuggle opened 1 year ago

dumitruPuggle commented 1 year ago

General Question

Read the Notes and fill out the form. Switch to Preview for reading.

Notes

Your issue will be closed if you violate any rule below.

Form

Put an [x] if you meet the condition, else leave [ ].

Question

A specific question, so it's understandable to anyone. You may add pictures.

Hello!

I've been having big trouble logging into instagram this week. I was trying to log in with a script that interacts with dom, which fills the login, password with my credentials. But the main problem, is that Instagram web app uses an framework called React, which doesn't rerender the component when I change manually the input using .value = "my value". In short: I need to find a way to collect sessionid, ds_user_id, rur, and other cookies. One way I've been able to do this is to create an request to https://www.instagram.com/accounts/login/ajax/. The problem is that this requires the 'enc_password' parameter, which I can't generate. I tried: https://github.com/dumitruPuggle/research/blob/main/scrapfly-ig-login.js - but it doesn't work. I've came across this library, which gave me some hope that this task could be accomplished. I tried to login using instagram-private-api, and it worked, but all I need, is just to get those cookies.

Thank you!

paha77 commented 1 year ago

Have you tried reading cookies from your automated browser?

dumitruPuggle commented 1 year ago

Yes, it returns cookies. The only problem is that I can't decide to run an automated headless browser on my production server, because it's too expensive.