instagram-private-api icon indicating copy to clipboard operation
instagram-private-api copied to clipboard

IgNotFoundError

Open anshtyagi0 opened this issue 1 year ago • 2 comments

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 avatar Apr 08 '23 07:04 anshtyagi0

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

anshtyagi0 avatar Apr 08 '23 07:04 anshtyagi0

Same problem

bakerman avatar Jun 14 '23 08:06 bakerman