Nerixyz / instagram_mqtt

Realtime and Push Notification (FBNS) support for the instagram-private-api
MIT License
253 stars 51 forks source link

IgCookieNotFoundError: Cookie "sessionid" not found #121

Closed eslam2511 closed 2 months ago

eslam2511 commented 2 months ago

I get this error when I try to connect

IgCookieNotFoundError: Cookie "sessionid" not found
    at State.extractCookieValue (/home/runner/ReelDownloaderBot/node_modules/instagram-private-api/dist/core/state.js:153:19)
    at RealtimeClient.constructConnection (/home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/realtime/realtime.client.js:45:89)
    at MQTToTClient.payloadProvider [as connectPayloadProvider] (/home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/realtime/realtime.client.js:95:22)
    at MQTToTClient.connect (/home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/mqttot/mqttot.client.js:54:42)
    at /home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/realtime/realtime.client.js:140:23
    at new Promise (<anonymous>)
    at RealtimeClient.connect (/home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/realtime/realtime.client.js:127:16)
    at RealtimeClient.wrapper (/home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/realtime/mixins/mixin.js:24:35)
    at RealtimeClient.wrapper (/home/runner/ReelDownloaderBot/node_modules/instagram_mqtt/dist/realtime/mixins/mixin.js:24:35)
    at postToInsta (file:///home/runner/ReelDownloaderBot/index.js:16:23)

and here is my code


import { IgApiClient } from "instagram-private-api";
import mqtt from "instagram_mqtt";
const { IgApiClientRealtime, withRealtime } = mqtt;
const postToInsta = async () => {
  try {
    //Contect Instagram API Client
    const ig = withRealtime(new IgApiClient());
    ig.state.generateDevice(procces.env.USERNAME);
    await ig.account.login(procces.env.USERNAME, proccess.env.PASSWORD);
    //listen for messages
    ig.realtime.on('message', (m) => console.log(m.message))
    ig.realtime.on('error', console.error)
    ig.realtime.on('close', () => console.error("RealtimeClient closed"))
    await ig.realtime.connect();
    setInterval(async () => {

      console.log("listening..");
    }, 10000);

  } catch (err) {
    return err;
  }
};

function logEvent(name) {
  return (data) => console.log(name, data);
}

postToInsta();
Nerixyz commented 2 months ago

Duplicate of #120.

eslam2511 commented 2 months ago

Duplicate of #120.

ya but it did not get fixed

Nerixyz commented 2 months ago

ya but it did not get fixed

The referenced issue is still open. Until it's closed, there's no need to open another one.