Skip to content

AlexeySKiselev/instagram-nodejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 

Repository files navigation

instagram-nodejs

Auth and get followers on instagram with nodejs

Important : you must update csrf token and sessionId only if password was changed

To install from npm repository (I recommended use yarn, but you can use npm):

yarn add instagram-nodejs-without-api

You can get instagram followers with next code:

Instagram = new Instagram()


Instagram.getCsrfToken().then((csrf) =>
{
  Instagram.csrfToken = csrf;
}).then(() =>
{
  Instagram.auth('inst-your-username', 'inst-your-password').then(sessionId =>
  {
    Instagram.sessionId = sessionId

    Instagram.getUserDataByUsername('username-for-get').then((t) =>
    {
      Instagram.getUserFollowers(JSON.parse(t).user.id).then((t) =>
      {
        console.log(t); // - instagram followers for user "username-for-get"
      })
    })

  })
})

Follow/unfollow

Inst = new Instagram()

Inst.csrfToken = 'your-csrf'
Inst.sessionId = 'your-session-id'
Inst.follow(3,0) //follow "kevin"
Inst.follow(3, 1) //unfollow "kevin"

Like/unlike

  //get media id by url and like
  Insta.getMediaIdByUrl('https://www.instagram.com/p/BT1ynUvhvaR/').then(r => Insta.like(r).then(d => console.log(d)))
  //get media id by url and unlike
  Insta.getMediaIdByUrl('https://www.instagram.com/p/BT1ynUvhvaR/').then(r => Insta.unlike(r).then(d => console.log(d)))

You can get user id with Inst.getUserDataByUsername() method

Star this repository on github, please. Thank you

About

Auth and get followers on instagram with nodejs

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%