Retrieve media without official instagram api support. (Based on promise)
npm install node-instagram-api
You need to fill CSRFTOKEN and SESSIONID later.
$ node login <<<
Username: example
Password:
If success, you will get
{ status: 'ok',
authenticated: true,
user: 'example',
csrftoken: '<YOUR CSRFTOKEN>',
sessionid: '<YOUR SESSIONID>' }
var nodeInstagram = require('node-instagram');
var ig = new nodeInstagram.Instagram({
sessionId: '<YOUR SESSIONID HERE>',
csrftoken: '<YOUR CSRFTOKEN HERE>'
})
Param | Type | Description |
---|---|---|
sessionId | String |
your instagram session id |
csrftoken | String |
your instagram csrftoken |
ig.fetchUserPost('fumeancat', 5).then(function(output) {
console.log(output.media.nodes)
}).fail(function(err) {
console.log(err)
});
ig.fetchTag('台南', 12, 1).then(function(output) {
console.log(output)
}).fail(function(err) {
console.log(err)
});
ig.fetchPost('BGQ3dhCEK73').then(function(output) {
console.log(output.media.likes.nodes)
}).fail(function(err) {
console.log(err)
});
Add a comment to a post.
ig.addComment('1261997285197436496', 'Test').then(function(output) {
console.log(output)
}).fail(function(err) {
console.log(err)
});
Send like to a post.
ig.addLike('1262841227841807675').then(function(output) {
console.log(output)
}).fail(function(err) {
console.log(err)
});
ig.fetchUserInfo('fumeancat').then(function(output) {
console.log(output);
}).fail(function(err) {
console.log(err);
})
Get follower of a user.
ig.fetchFollower('fumeancat', 999).then(function(output) {
console.log(output.followed_by.nodes);
}).fail(function(err) {
console.log(err);
})
Get user follows.
ig.fetchFollows('fumeancat', 999).then(function(output) {
console.log(output.follows.nodes);
}).fail(function(err) {
console.log(err);
})