Read the Notes and fill out the form.
Switch to Preview for reading.
Your issue will be closed if you violate any rule below.
Put an [x] if you meet the condition, else leave [ ].
A specific question, so it's understandable to anyone.
You may add pictures.
YOUR QUESTION HERE
Hi everyone, I'm new here.
I found this great module after some search and I tested it, I can't say anything accept "perfect! nice work!".
I know that my account can get banned while using this module in the wrong way, so I want to know what's the correct and the recommended way to login.
I checked some examples but everything is writen in typescript, and I only know js.
I know about saving session and similar things, and I should set limits for requests to avoid spam...
This is what I did for now:
require("dotenv");
const { IgApiClient } = require("instagram-private-api");
鈥媍onst ig = new IgApiClient();
ig.state.generateDevice(process.env.IG_USERNAME);
async function IgLogin(){
await ig.account.login(process.evn.IG_USERNAME, process.evn.IG_PASSWORD);
}
And thx.
what's the correct and the recommended way to login
The session example should contain the reccomended way.
You don't have to log in after loading the session so you can wrap it in an else {...}.
You can also call ig.simulate.pre/postLoginFlow() before and after logging in.
I checked some examples but everything is writen in typescript, and I only know js.
TypeScript is a superset of JavaScript. The examples there will often translate 1:1 to JavaScript (except the type annotations e.g. function(a: string): number "translates" to function(a) and node doesn't yet have ESModules so import {a} from 'b' would be const {a} = require('b'))
Thx.
What's the functionality of ig.simulate.preLoginFlow() and ig.simulate.postLoginFlow()?
preLoginFlow() makes the requests the app does before logging in and postLoginFlow() does it for the requests after logging in.
So these functions simulate some normal-default requetes in the app to make the API know that the account is a regular user and not a bot?
So these functions simulate some normal-default requetes in the app to make the API know that the account is a regular user and not a bot?
Right, although nothing is perfect.
Most helpful comment
The session example should contain the reccomended way.
You don't have to log in after loading the session so you can wrap it in an else {...}.
You can also call
ig.simulate.pre/postLoginFlow()before and after logging in.TypeScript is a superset of JavaScript. The examples there will often translate 1:1 to JavaScript (except the type annotations e.g.
function(a: string): number"translates" tofunction(a)and node doesn't yet have ESModules soimport {a} from 'b'would beconst {a} = require('b'))