A simple library with actions that instagram API don't have.
$ npm i instagood
First of all, if you want to use instagood, you need to get some infos manually (at this moment):
- Login to instagram web
- Open devtools
- Enable log requests (network tab)
- Follow someone
- In network tab, open 'follow/' request log
- Get what you need in 'Request Headers' section
Save x-csrftoken
and sessionid
(note that sessionid is inside a parameter string, so copy the code after =
until ;
).
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));
Open a new issue.
- Improve 'Usage' section
- Implement more methods (list all medias from the user, sugest)
- Write some tests