Socket
Socket
Sign inDemoInstall

nodejs-instagram-api

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-instagram-api

This Node.js script provides automation for interacting with Instagram using the Instagram Private API. It covers login, profile information retrieval, and fetching user feed data.


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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();
  
})();

Keywords

FAQs

Package last updated on 31 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc