dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.85k stars 1.13k forks source link

API Endpoint not found #1770

Closed RodrigoSKohl closed 1 week ago

RodrigoSKohl commented 3 months ago
IgNotFoundError: GET /api/v1/fbsearch/suggested_searches/?type=users - 404 Not Found; 
    at Request.handleResponseError (C:\bot_insta\insta_bot\node_modules\instagram-private-api\dist\core\request.js:103:20)
    at Request.send (C:\bot_insta\insta_bot\node_modules\instagram-private-api\dist\core\request.js:54:28)
    at async FbsearchRepository.suggestedSearches (C:\bot_insta\insta_bot\node_modules\instagram-private-api\dist\repositories\fbsearch.repository.js:7:26)
IgNotFoundError: GET /api/v1/fbsearch/suggested_searches/?type=users - 404 Not Found; 
    at Request.handleResponseError (C:\bot_insta\insta_bot\node_modules\instagram-private-api\dist\core\request.js:103:20)
    at Request.send (C:\bot_insta\insta_bot\node_modules\instagram-private-api\dist\core\request.js:54:28)
    at async FbsearchRepository.suggestedSearches (C:\bot_insta\insta_bot\node_modules\instagram-private-api\dist\repositories\fbsearch.repository.js:7:26)

I am getting this error after pos-login, I can get around this by commenting out the lines

// () => this.client.fbsearch.suggestedSearches('users'),
// () => this.client.fbsearch.suggestedSearches('blended'),

the problem is that when doing this, when sending some messages through the API my account receives a 3 day restriction on sending messages

haneenmahd commented 3 months ago

I can confirm this and this doesn't happen after I remove the post login flow execution in my case:

import { IgApiClient } from 'instagram-private-api'
import dotenv from "dotenv";

dotenv.config();

const ig = new IgApiClient();
ig.state.generateDevice(process.env.IG_USERNAME);
(async () => {
    await ig.simulate.preLoginFlow();
    const loggedInUser = await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);
    // process.nextTick(async () => await ig.simulate.postLoginFlow());
    const userFeed = ig.feed.user(loggedInUser.pk);
    const myPostsFirstPage = await userFeed.items();;
    console.log(myPostsFirstPage[0])
})();
broskisworld commented 3 months ago

Same here. Removing the ig.simulate.postLoginFlow() removed the error for me but I worry that may end up having other side effects / increasing likelihood of bot detection.

haneenmahd commented 3 months ago

Yes, that does cause other side effects. The API becomes pretty unusable after removing that.

sunmasters commented 1 week ago

The prelogin /post login flows are outdated. You don't need to use