1.1.5 • Published 4 months ago
nodejs-instagram-api v1.1.5
Instagram Automation with Node.js
Overview
This Node.js script provides automation for interacting with Instagram using the NodeJS Instagram API. It covers login, profile information retrieval, and fetching user feed data.
Analysis the Instagram client-side password encryption by Reverse Enginering
Features
- Login to Instagram: With this script, you can automate the login process to Instagram by providing your credentials. The script utilizes the Instagram Private API to handle the authentication and login procedures programmatically.
- Profile Information: The script allows you to retrieve comprehensive profile information for a specified Instagram user. This includes details such as the user's bio, profile picture, follower count, following count, and other relevant information.
- User Feed Data: You can fetch and analyze the latest posts and activity from a targeted Instagram user's feed. This includes posts, captions, timestamps, and other relevant data to keep you updated on a user's recent Instagram activity.
- Followers and Following Lists: You can fetch followers and follow list from a targeted Instagram user's.
Prerequisites
- Node.js installed on your machine v18.16.0
- Instagram account credentials (username and password)
- NodeJS Instagram API library
Setup
Install npm package to your local machine.
npm i nodejs-instagram-api
Usage
Customize the script according to your needs and execute it to automate various Instagram interactions.
- Import dependency
const api = require('nodejs-instagram-api');
- Initialize InstagramLogin
(async () => {
var username = 'your-username';
var password = 'your-password';
const instagramLogin = new api.InstagramLogin(proxyOptions=null, username, password);
const loginData = await instagramLogin.login();
})();
{
cookie: 'csrftoken=XXXXX; rur="XXXXX"; mid=XXXXX; ds_user_id=XXXXX; sessionid=XXXXX',
username: 'your-username',
password: 'your-password',
x_ig_app_id: 'XXXXX',
x_csrftoken: 'XXXXX',
ig_did: 'XXXXX',
x_instagram_ajax: 'XXXXX'
}
- Fetch and display profile information
(async () => {
const webProfileInfo = new api.WebProfileInfo(loginData, proxyOptions=null, "target-username");
const profileData = await webProfileInfo.getProfileData();
})();
- Fetch and display user feed data
(async () => {
const userFeed = new api.UserFeed(loginData, proxyOptions=null, "target-username");
const userFeedData = await userFeed.getUserFeedData();
})();
- Initialize InstagramLogin over Proxy
(async () => {
const proxyOptions = {
host: 'proxy-hostname',
port: 80,
username: 'proxy-username',
password: 'proxy-password'
};
var username = 'your-username';
var password = 'your-password';
const instagramLogin = new api.InstagramLogin(proxyOptions, username, password);
const loginData = await instagramLogin.login();
})();
- Followers and Following Lists
- The FriendShip class is configured with relevant parameters, including a timeout of 5 seconds (secTimeout) and a page size of 200 (pageSize).
- Asynchronous calls are made to retrieve the followers and following lists of the target user using the getFollowers and getFollowing methods, respectively.
- Sample output
(async () => {
// Extract the target user's ID from the profile data
// Create a new instance of the FriendShip class with relevant parameters
const webProfileInfo = new api.WebProfileInfo(loginData, proxyOptions=null, "target-username");
const profileData = await webProfileInfo.getProfileData();
const targetUser = profileData.data.user.id;
const friendShip = new api.FriendShip(loginData, null, targetUser, secTimeout=5, pageSize=200);
// Use asynchronous calls to get the followers and following lists
var followers = await friendShip.getFollowers();
var following = await friendShip.getFollowing();
})();