instagram-api-web-node
TypeScript icon, indicating that this package has built-in type declarations

5.2.21 • Public • Published

instagram-api-web

Recode from :

How to install

npm i instagram-web-api-node

How to use

const { IgApiClient } = require("instagram-web-api-node");
function save(data){
  let cookie = JSON.stringify(data); 
  //save cookie to file or database after 
  //code save
  return cookie;
}
(async () => { 
  try {
      const instagram = new IgApiClient();
      // This function executes after every request
      instagram.request.end$.subscribe(async () => {
        const serialized = await instagram.state.serialize();
        save(serialized); 
      });
      //set login account
      const { username, password } = process.env; 
      await instagram.state.generateDevice(); 
      //login use account username and password
      await instagram.ig.login(username, password);
  } catch (error){
      console.log(error.name)
  }
})();

How to login without username and password

const { IgApiClient } = require("instagram-web-api-node");
(async () => { 
  try {
      const instagram = new IgApiClient();
      await instagram.state.deserialize(cookie); //cookiejson
      
      const follow = instagram.ig.follow(userid);
  } catch (error){
      console.log(error.name)
  }

Readme

Keywords

Package Sidebar

Install

npm i instagram-api-web-node

Weekly Downloads

44

Version

5.2.21

License

ISC

Unpacked Size

248 kB

Total Files

209

Last publish

Collaborators

  • yellowpanda