Skip to content

@igpapi *@2.x.x description

Dmitry edited this page Mar 27, 2020 · 11 revisions

We are glad to announce the next 2.x.x version of this library. It's a big release. We have significantly expanded the functionality and capabilities. The library turned into a monorepository and now it's a set of libraries, connected in an ecosystem:

package name description
@igpapi/android Basically it's just an improved version of the public instagram-private-api.
@igpapi/web API client for web Instagram application (https://www.instagram.com).
@igpapi/android-realtime Brings all the android realtime stuff to your code. Yes, you can subscribe to new messages.
@igpapi/web-mqtt Brings all the web realtime stuff to your code.
@igpapi/chrome NEW! Headless chrome browser automation
@igpapi/sticker Just a sticker constructor for the stories.

You can share one session between all these libraries. For example, you can log in with @igpapi/android, and pass this session to any other library, it will work.

I can't publish the full feature list, because it would be very big. There are a lot of functions. So please, don't ask me about it. Better ask me if it supports the feature you need.

@igpapi/chrome

This package uses a real chromium browser under the hood. While debugging on your desktop OS you can watch, how the browser is opened and executes some magic for you. On a production server, the browser executes in headless mode, this means that there is no graphic UI on the display, but it exists in your server's memory. So you can run it on every server just like any other npm package. It gives you the most real human-like behavior on the market. For example, it is known that bare Instagram challenges work unstable now. This problem is fairly simple was resolved in this module.

Challenge example
import { ChromeIgpapiFactory } from '@igpapi/chrome';
import { AndroidIgpapi, IgCheckpointError } from '@igpapi/android';
import * as Bluebird from 'bluebird';
import * as inquirer from 'inquirer';

const android = new AndroidIgpapi();
Bluebird.try(() => android.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD)).catch(
  IgCheckpointError,
  async () => {
    await android.challenge.selectVerifyMethod('1');
    const chrome = await ChromeIgpapiFactory.create(android.state, { headless: false, devtools: true });
    const challengePage = await chrome.page.challenge({ apiPath: android.state.checkpoint.challenge.api_path });
    const { code } = await inquirer.prompt([
      {
        type: 'input',
        name: 'code',
        message: 'Enter code',
      },
    ]);
    const checkpointResponse = await challengePage.sendCode(code);
    console.log(await checkpointResponse.json());
    await chrome.syncCookies(android.state);
    console.log(await android.account.currentUser());
  },
);

There are also likes and follows implemented. If you need anything else to be implemented, please, contact me, we can discuss it.

Clone this wiki locally