1.1.5 • Published 4 months ago

nodejs-instagram-api v1.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

image

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

  1. 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.
  2. 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.
  3. 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.
  4. 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

  1. 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
  1. The FriendShip class is configured with relevant parameters, including a timeout of 5 seconds (secTimeout) and a page size of 200 (pageSize).
  2. Asynchronous calls are made to retrieve the followers and following lists of the target user using the getFollowers and getFollowing methods, respectively.
  3. 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();
  
})();
1.1.5

4 months ago

1.1.4

4 months ago

1.1.3

4 months ago

1.1.2

4 months ago

1.1.0

4 months ago

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.2

4 months ago

1.0.0

4 months ago