Giter Site home page Giter Site logo

Comments (10)

apabinc avatar apabinc commented on May 25, 2024 2

I can confirm as well. I'm seeing the same behavior and until Mar 1 2024 the login was working

from instagram-private-api.

prokoposgiannis avatar prokoposgiannis commented on May 25, 2024 2

Me too, I've been seeing the same error since March 2 while trying to upload a story on instagram.

from instagram-private-api.

CaptainTron avatar CaptainTron commented on May 25, 2024 1

for now you can use this but make sure the filetype should be of .jpg
`
require("dotenv").config();

const express = require('express')
const app = express()
const port = process.env.PORT || 4000;
const fs = require('fs');

app.listen(port, () => {
console.log(Listening on port ${port})
})

const { IgApiClient } = require('instagram-private-api');
const { get } = require('request-promise');

const postToInsta = async () => {

const ig = new IgApiClient();
ig.state.generateDevice(process.env.IG_USERNAME);
await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);

const imageFilePath = '222.jpg';

try {
    const imageBuffer = fs.readFileSync(imageFilePath);

    const publish = await ig.publish.photo({
        file: imageBuffer,
        caption: 'RTTTT',
    });

    console.log(publish)

} catch (error) {
    console.error('Error reading the image file:', error);
}

}

postToInsta()`

from instagram-private-api.

tiagobbraga avatar tiagobbraga commented on May 25, 2024 1

It's very funny... At localhost it works, but without session.

async #login(username, password, agent) {
    this.#client = new IgApiClient();
    this.#client.state.generateDevice(username);
    this.#client.request.defaults.agent = agent;

    // this.#client.request.end$.subscribe(async () => {
    //   const serialized = await this.#client.state.serialize();
    //   console.log("serialized");
    //   delete serialized.constants; // this deletes the version info, so you'll always use the version provided by the library
    //   this.#saveSession(serialized);
    // });

    // if (this.#existsSession()) {
    //   console.log("exists");
    //   const session = await this.#loadSession();
    //   if (session && Object.keys(session).length > 0) {
    //     console.log("deserialize");
    //     await this.#client.state.deserialize(session);
    //     return;
    //   }
    // }

    console.log("login");
    await this.#client.account.login(username, password);
  }

Works with the latest version 1.46.1!

Thanks @Nerixyz

from instagram-private-api.

Neoxsam avatar Neoxsam commented on May 25, 2024

Same here

from instagram-private-api.

apabinc avatar apabinc commented on May 25, 2024

The current workaround is to overwrite the instagram-private-api package in your package.json like this:

  "dependencies": {
    ...
    "instagram-private-api": "Nerixyz/instagram-private-api#update-constants",
    ...
  }

Kudos to @Nerixyz

Reference: #1572

from instagram-private-api.

dilame avatar dilame commented on May 25, 2024

Could anyone check if it works now?

from instagram-private-api.

amoraschi avatar amoraschi commented on May 25, 2024

Could anyone check if it works now?

I get this error when trying to publish anything (post/story):

C:\...\node_modules\instagram-private-api\dist\core\state.js:143
            throw new errors_1.IgCookieNotFoundError(key);
                  ^

IgCookieNotFoundError: Cookie "ds_user_id" not found

from instagram-private-api.

tiagobbraga avatar tiagobbraga commented on May 25, 2024

It's very funny... At localhost it works, but without session.

async #login(username, password, agent) {
    this.#client = new IgApiClient();
    this.#client.state.generateDevice(username);
    this.#client.request.defaults.agent = agent;

    // this.#client.request.end$.subscribe(async () => {
    //   const serialized = await this.#client.state.serialize();
    //   console.log("serialized");
    //   delete serialized.constants; // this deletes the version info, so you'll always use the version provided by the library
    //   this.#saveSession(serialized);
    // });

    // if (this.#existsSession()) {
    //   console.log("exists");
    //   const session = await this.#loadSession();
    //   if (session && Object.keys(session).length > 0) {
    //     console.log("deserialize");
    //     await this.#client.state.deserialize(session);
    //     return;
    //   }
    // }

    console.log("login");
    await this.#client.account.login(username, password);
  }

from instagram-private-api.

razbakov avatar razbakov commented on May 25, 2024

Issue is fixed with 1.46.1. Thanks @Nerixyz

from instagram-private-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.