NodeJS Instagram private API client
Install
From npm
npm install instagram-private-api
From github
npm install github:dilame/instagram-private-api
Examples
You can find usage examples here
import { IgApiClient } from './src';
import { sample } from 'lodash';
const ig = new IgApiClient();
ig.state.generateDevice(process.env.IG_USERNAME);
ig.state.proxyUrl = process.env.IG_PROXY;
(async () => {
await ig.simulate.preLoginFlow();
const loggedInUser = await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);
process.nextTick(async () => await ig.simulate.postLoginFlow());
const userFeed = ig.feed.user(loggedInUser.pk);
const myPostsFirstPage = await userFeed.items();
const myPostsSecondPage = await userFeed.items();
await ig.media.like({
mediaId: sample([myPostsFirstPage[0].id, myPostsSecondPage[0].id]),
moduleInfo: {
module_name: 'profile',
user_id: loggedInUser.pk,
username: loggedInUser.username,
},
d: sample([0, 1]),
});
})();
Contribution
If you need features that is not implemented - feel free to implement and create PRs!
Plus we need some documentation, so if you are good in it - you are welcome.
Useful links
instagram-id-to-url-segment - convert the image url fragment to the media ID
Special thanks
Original author of this library is Richard Hutta. Thanks to him for starting it.
End User License Agreement (EULA)
- You will not use this repository for sending mass spam or any other malicious activity
- We / You will not support anyone who is violating this EULA conditions
- Repository is just for learning / personal purposes thus should not be part of any
service available on the Internet that is trying to do any malicious activity (mass bulk request, spam etc.)