@kevindesousa/asktagram
v1.0.0
Published
Library to request Instagram API
Downloads
2
Maintainers
Readme
Asktagram
A simple library with actions that instagram API don't have.
Install via Package Managers
$ npm i @kevindesousa/asktagram
Dependencies
Tests
Tutorial
First of all, if you want to use asktagram, 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 ;
).
- Create a .env file with
username=keviiindesousa
csrftoken=XXX
sessionid=XXX
Usage
Import asktagram
const asktagram = require('@kevindesousa/asktagram');
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 asktagram();
Get user information
user.getUserInfo('keviiindesousa').then((response) => console.log(response), (err) => console.log(err));
Get user followers
user.getFriendships('followers', 'keviiindesousa', 20).then((response) => console.log(response.followers), (err) => console.log(err));
Get user following
user.getFriendships('following', 'keviiindesousa', 20).then((response) => console.log(response.followers), (err) => console.log(err));
Follow someone (in this case, me)
user.friendships('follow', 'keviiindesousa').then((response) => console.log(response), (err) => console.log(err));
Unfollow someone
user.friendships('unfollow', 'keviiindesousa').then((response) => console.log(response), (err) => console.log(err));
Like any media
user.likes('like', '2139822402444661909').then((response) => console.log(response), (err) => console.log(err));
Unlike any media
user.likes('unlike', '2139822402444661909').then((response) => console.log(response), (err) => console.log(err));
Comment any media
user.comments('2139822402444661909', 'I liked!').then((response) => console.log(response), (err) => console.log(err));
Problems, bugs or questions?
Open a new issue.