/instagood

A simple library with actions that instagram API don't have.

Primary LanguageJavaScriptMIT LicenseMIT

instagood

A simple library with actions that instagram API don't have.

NPM

Maintainability Build Status Dependencies Status

Install via Package Managers

$ npm i instagood

Dependencies

Tests

Tutorial

First of all, if you want to use instagood, you need to get some infos manually (at this moment):

  1. Login to instagram web
  2. Open devtools
  3. Enable log requests (network tab)
  4. Follow someone
  5. In network tab, open 'follow/' request log
  6. Get what you need in 'Request Headers' section

How to get csrftoken and session id

Save x-csrftoken and sessionid (note that sessionid is inside a parameter string, so copy the code after = until ;).

Usage

Import instagood

const instagood = require('instagood');

Instance a new user (for csrftoken and sessionid see Tutorial section)

Note: user must be the logged one (the one who you got csrftoken and sessionid). If you logout, your csrftoken and sessionid will be removed from instagram auth.

const user = new instagood('user', 'csrftoken', 'sessionid');

Get user information

user.getUserInfo('reidarking').then((response) => console.log(response), (err) => console.log(err));

Get user followers

user.getFriendships('followers', 'reidarking', 20).then((response) => console.log(response.followers), (err) => console.log(err));

Get user following

user.getFriendships('following', 'reidarking', 20).then((response) => console.log(response.followers), (err) => console.log(err));

Follow someone (in this case, me)

user.friendships('follow', 'reidarking').then((response) => console.log(response), (err) => console.log(err));

Unfollow someone

user.friendships('unfollow', 'reidarking').then((response) => console.log(response), (err) => console.log(err));

Like any media

user.likes('like', '1973268968068413381').then((response) => console.log(response), (err) => console.log(err));

Unlike any media

user.likes('unlike', '1973268968068413381').then((response) => console.log(response), (err) => console.log(err));

Comment any media

user.comments('1973450160415933226', 'I liked!').then((response) => console.log(response), (err) => console.log(err));

Problems, bugs or questions?

Open a new issue.

Roadmap

  • Improve 'Usage' section
  • Implement more methods (list all medias from the user, sugest)
  • Write some tests