How to use the instagram-private-api.V1.Exceptions function in instagram-private-api

To help you get started, we’ve selected a few instagram-private-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github igdmapps / igdm / main / instagram.js View on Github external
exports.isCheckpointError = (error) => {
  return (error instanceof Client.Exceptions.CheckpointError)
}
github igdmapps / igstories / main / instagram.js View on Github external
exports.isCheckpointError = (error) => {
  return (error instanceof Client.Exceptions.CheckpointError)
}
github Elyx0 / instagram-inbox-api / src / server.js View on Github external
import path from 'path';
import fs from 'fs';
import crypto from 'crypto';
import micro, { json } from 'micro';
import { router, get, post } from 'microrouter';

import { V1 as Client } from 'instagram-private-api';

import { register, read } from './instapi';

const { CookieNotValidError, AuthenticationError } = Client.Exceptions;

const cors = require('micro-cors')();

const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)));

const cookiesJar = path.join(__dirname, '/cookies');
if (!fs.existsSync(cookiesJar)) {
  fs.mkdirSync(cookiesJar);
}

const paramError = {
  error: {
    name: 'ParameterError',
    message: 'Both user and password are required.',
  },
};
github igdmapps / igstories / main / instagram.js View on Github external
return new Promise((resolve, reject) => {
    if (!session) {
      const device = utils.getDevice();
      const storage = utils.getCookieStorage();
      if (!device || !storage) {
        return resolve({ isLoggedIn: false });
      }
      session = new Client.Session(device, storage);
    }

    session.getAccountId()
      .then(() => resolve({ isLoggedIn: true, session }))
      .catch(Client.Exceptions.CookieNotValidError, () => resolve({ isLoggedIn: false }))
  });
}
github igdmapps / igdm / main / instagram.js View on Github external
return new Promise((resolve, reject) => {
    if (!session) {
      const device = utils.getDevice();
      const storage = utils.getCookieStorage();
      if (!device || !storage) {
        return resolve({ isLoggedIn: false });
      }
      session = new Client.Session(device, storage);
    }

    session.getAccountId()
      .then(() => resolve({ isLoggedIn: true, session }))
      .catch(Client.Exceptions.CookieNotValidError, () => resolve({ isLoggedIn: false }))
  });
}