dilame / instagram-private-api

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

IgNotFoundError #1690

Open anshtyagi0 opened 1 year ago

anshtyagi0 commented 1 year ago

Code

 async function getLatestPostOrReel(username) {
            const userFeed = ig.feed.user(username);
            const timelineFeed = ig.feed.timeline();
            const [userMediaItems, timelineMediaItems] = await Promise.all([
                userFeed.items(),
                timelineFeed.items()
            ]);
            const latestMediaItem = [...userMediaItems, ...timelineMediaItems].sort((a, b) => b.taken_at_timestamp - a.taken_at_timestamp)[0];
            return latestMediaItem;
        }

Error

           return new errors_1.IgNotFoundError(response);
                   ^

IgNotFoundError: GET /api/v1/feed/user/username/ - 404 Not Found; 
    at Request.handleResponseError (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/core/request.js:103:20)
    at Request.send (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/core/request.js:54:28)
    at async UserFeed.request (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/feeds/user.feed.js:21:26)
    at async UserFeed.items (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/node_modules/instagram-private-api/dist/feeds/user.feed.js:31:22)
    at async Promise.all (index 0)
    at async getLatestPostOrReel (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/Events/ready.5.js:47:58)
    at async Timeout.main [as _onTimeout] (/Users/anshtyagi/Documents/BACKUP/Cosmicbot/Events/ready.5.js:72:35)
anshtyagi0 commented 1 year ago

I am trying to get the latest post of a user.

bakerman commented 1 year ago

Same problem