How to use the instagram-private-api.V1.Session 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 terkelg / ramme / src / common / api / user.js View on Github external
const loadSession = async user => {
  let path = utils.buildPath(user.hash)
  let device = new api.Device(user.username)
  let storage = new api.CookieFileStorage(path)
  if (storage) {
    return new api.Session(device, storage)
  } else {
    let file = await createSessionFile(user)
    if (file) console.log('Session File Created')
    return 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 }))
  });
}
github terkelg / ramme / src / common / api / media.js View on Github external
const loadSession = user => {
  let path = utils.buildPath(user.hash)
  let device = new api.Device(user.username)
  let storage = new api.CookieFileStorage(path)
  return new api.Session(device, storage)
}
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) => {
    const device = utils.getDevice(username);
    const storage = utils.getCookieStorage(`${username}.json`);
    const session = new Client.Session(device, storage);
    const request = new Client.Request(session);
    request.setMethod('POST')
              .setUrl(Client.CONSTANTS.API_ENDPOINT + "accounts/two_factor_login/")
              .generateUUID()
              .setData({
                  username: username,
                  verification_code: code,
                  two_factor_identifier: twoFactorIdentifier,
                  trust_this_device: trustThisDevice,
                  verification_method: verificationMethod,
              })
              .signPayload()
              .send()
              .then(() => session.loginFlow())
              .then(() => resolve(session))
              .catch(reject)